Improve Error Page

This commit is contained in:
2020-12-15 15:31:14 +01:00
parent 312890a3ad
commit a64a080ce7
13 changed files with 77 additions and 79 deletions

View File

@@ -120,8 +120,12 @@ export default {
liked: false
}
},
async asyncData({ params, $content, app, $axios }) {
const post = await $content(`articles/${app.i18n.locale}/`, params.slug).fetch()
async asyncData({ params, $content, app, $axios, error }) {
const post = await $content(`articles/${app.i18n.locale}/`, params.slug)
.fetch()
.catch(() => {
error({ statusCode: 404, message: "Post not found" });
});
const {data: likes} = await $axios.get(`posts/${params.slug}`)
const liked = await $axios.get(`posts/is/${params.slug}`)
return {

View File

@@ -112,9 +112,11 @@ export default {
methods: {
displayTags(tags) {
const tags_label = []
tags.map(tag => {
tags_label.push(tag)
})
if (tags.length > 0) {
tags.map(tag => {
tags_label.push(tag)
})
}
return tags_label
},
async fetchPostsByTag(tag) {