handle all not found errors

This commit is contained in:
Amir Mohamadi
2021-12-31 17:01:17 +03:30
parent 5c07791225
commit 064d642b7e
47 changed files with 3386 additions and 3238 deletions
+10 -6
View File
@@ -180,12 +180,16 @@ export default {
}
},
layout: 'admin',
async asyncData({$axios, params}) {
const post = await $axios.get(`/api/public/blog/${params.post}`)
const blogCategories = await $axios.get(`/api/public/blogCategories`)
return {
post: post.data,
blogCategories: blogCategories.data
async asyncData({$axios, params, error}) {
try {
const post = await $axios.get(`/api/public/blog/${params.post}`)
const blogCategories = await $axios.get(`/api/public/blogCategories`)
return {
post: post.data,
blogCategories: blogCategories.data
}
} catch (e) {
error({status: 404, message: 'Page not found'})
}
}
}