handle all not found errors
This commit is contained in:
@@ -177,12 +177,16 @@ export default {
|
||||
title: this.product.product_details[this.$route.params.lang].name
|
||||
}
|
||||
},
|
||||
async asyncData({$axios, params}) {
|
||||
let product = await $axios.get(`/api/public/product/${params.product}`)
|
||||
let productCategories = await $axios.get(`/api/public/productCategories`)
|
||||
return {
|
||||
product: product.data,
|
||||
productCategories: productCategories.data
|
||||
async asyncData({$axios, params, error}) {
|
||||
try {
|
||||
let product = await $axios.get(`/api/public/product/${params.product}`)
|
||||
let productCategories = await $axios.get(`/api/public/productCategories`)
|
||||
return {
|
||||
product: product.data,
|
||||
productCategories: productCategories.data
|
||||
}
|
||||
} catch (e) {
|
||||
error({status: 404, message: 'Page not found'})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,15 +106,19 @@ export default {
|
||||
title: this.staticData.hero
|
||||
}
|
||||
},
|
||||
async asyncData({$axios, store}) {
|
||||
const products = await $axios.get(`/api/public/products`)
|
||||
const productCategories = await $axios.get(`/api/public/productCategories`)
|
||||
const catalog = await $axios.get('/api/public/catalog')
|
||||
async asyncData({$axios, store, error}) {
|
||||
try {
|
||||
const products = await $axios.get(`/api/public/products`)
|
||||
const productCategories = await $axios.get(`/api/public/productCategories`)
|
||||
const catalog = await $axios.get('/api/public/catalog')
|
||||
|
||||
return {
|
||||
products: products.data,
|
||||
productCategories: productCategories.data,
|
||||
catalog: catalog.data
|
||||
return {
|
||||
products: products.data,
|
||||
productCategories: productCategories.data,
|
||||
catalog: catalog.data
|
||||
}
|
||||
} catch (e) {
|
||||
error({status: 404, message: 'There is a problem here'})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user