gzuioidjkclq
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
cd01c00d61
commit
83dc3fff96
@ -1,11 +0,0 @@
|
|||||||
export default defineNuxtRouteMiddleware((to, from) => {
|
|
||||||
const basePath = '/containers/matheothierry-portfolio_nuxt'
|
|
||||||
|
|
||||||
// Si nous sommes déjà sur le bon chemin, ne rien faire
|
|
||||||
if (to.fullPath.startsWith(basePath)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sinon, rediriger vers le bon chemin
|
|
||||||
return navigateTo(basePath + to.fullPath, { redirectCode: 301 })
|
|
||||||
})
|
|
@ -1,17 +1,17 @@
|
|||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin({
|
||||||
const router = useRouter()
|
name: 'router',
|
||||||
const route = useRoute()
|
enforce: 'pre',
|
||||||
|
setup(nuxtApp) {
|
||||||
// Empêcher la redirection vers la racine
|
nuxtApp.vueApp.config.errorHandler = (error, instance, info) => {
|
||||||
router.beforeEach((to, from, next) => {
|
console.error('Vue Error:', error)
|
||||||
const basePath = '/containers/matheothierry-portfolio_nuxt'
|
console.error('Component:', instance)
|
||||||
|
console.error('Info:', info)
|
||||||
// Si l'URL ne commence pas par le bon chemin, rediriger vers le bon chemin
|
|
||||||
if (!to.fullPath.startsWith(basePath)) {
|
|
||||||
next(basePath + to.fullPath)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
next()
|
nuxtApp.hook('vue:error', (error, instance, info) => {
|
||||||
})
|
console.error('Vue Error:', error)
|
||||||
|
console.error('Component:', instance)
|
||||||
|
console.error('Info:', info)
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
Loading…
Reference in new issue