added 404 notfound behavior
This commit is contained in:
+13
-2
@@ -160,7 +160,7 @@ export default {
|
|||||||
console.log('texts/toc REST: data', data)
|
console.log('texts/toc REST: data', data)
|
||||||
this.meta = data.meta
|
this.meta = data.meta
|
||||||
this.author = data.meta.author
|
this.author = data.meta.author
|
||||||
if (data.content) {
|
if (data.content && data.content !== 'vide') {
|
||||||
if (Array.isArray(data.content)) {
|
if (Array.isArray(data.content)) {
|
||||||
this.toc = data.content
|
this.toc = data.content
|
||||||
} else {
|
} else {
|
||||||
@@ -171,10 +171,16 @@ export default {
|
|||||||
// console.log('toc', this.toc)
|
// console.log('toc', this.toc)
|
||||||
this.textid = this.toc[0].children[1].uuid
|
this.textid = this.toc[0].children[1].uuid
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('Bad edition uuid', this.$route.params.id, this.$route)
|
||||||
|
this.$router.replace({
|
||||||
|
name: 'notfound',
|
||||||
|
query: { fullpath: this.$route.path }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with locorum', error)
|
console.warn('Issue with text toc', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -240,7 +246,12 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with getTextContent', error)
|
console.warn('Issue with getTextContent', error)
|
||||||
|
console.warn('Bad edition uuid', this.$route.params.id, this.$route)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
|
this.$router.replace({
|
||||||
|
name: 'notfound',
|
||||||
|
query: { fullpath: this.$route.path }
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onCenterScrolled (e) {
|
onCenterScrolled (e) {
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with locorum', error)
|
console.warn('Issue with locorum', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
|
this.$router.replace({
|
||||||
|
name: 'notfound',
|
||||||
|
query: { fullpath: this.$route.path }
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with nominum', error)
|
console.warn('Issue with nominum', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
|
this.$router.replace({
|
||||||
|
name: 'notfound',
|
||||||
|
query: { fullpath: this.$route.path }
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<template>
|
||||||
|
<MainContentLayout id="not-found" class="">
|
||||||
|
<template v-slot:header>
|
||||||
|
<h1>404 - Contenu non trouvé</h1>
|
||||||
|
<code v-if="path">{{ path }}</code>
|
||||||
|
</template>
|
||||||
|
</MainContentLayout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import MainContentLayout from '../components/Layouts/MainContentLayout'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'NotFound',
|
||||||
|
components: {
|
||||||
|
MainContentLayout
|
||||||
|
},
|
||||||
|
// data: () => ({
|
||||||
|
// }),
|
||||||
|
computed: {
|
||||||
|
path () {
|
||||||
|
if (this.$route.query.fullpath) {
|
||||||
|
return this.$route.query.fullpath
|
||||||
|
} else if (this.$route.params.pathMatch) {
|
||||||
|
return this.$route.params.pathMatch
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
console.log('NotFound created', this.$route)
|
||||||
|
},
|
||||||
|
metaInfo () {
|
||||||
|
return {
|
||||||
|
title: `Not Found`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
@@ -46,6 +46,10 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with operum', error)
|
console.warn('Issue with operum', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
|
this.$router.replace({
|
||||||
|
name: 'notfound',
|
||||||
|
query: { fullpath: this.$route.path }
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import Nominum from 'pages/Nominum'
|
|||||||
import Locorum from 'pages/Locorum'
|
import Locorum from 'pages/Locorum'
|
||||||
import Operum from 'pages/Operum'
|
import Operum from 'pages/Operum'
|
||||||
import Bibliographie from 'pages/Bibliographie'
|
import Bibliographie from 'pages/Bibliographie'
|
||||||
|
import NotFound from 'pages/NotFound'
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
@@ -82,6 +83,12 @@ const routes = [
|
|||||||
name: 'bibliographie',
|
name: 'bibliographie',
|
||||||
path: '/bibliographie',
|
path: '/bibliographie',
|
||||||
component: Bibliographie
|
component: Bibliographie
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'notfound',
|
||||||
|
path: '/404',
|
||||||
|
alias: '*',
|
||||||
|
component: NotFound
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user