all from ai here
continuous-integration/drone/push Build is passing Details

master
37b7 3 weeks ago
parent a386f4e5c4
commit cd01c00d61

@ -0,0 +1,11 @@
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 })
})

@ -43,6 +43,13 @@ export default defineNuxtConfig({
router: { router: {
options: { options: {
strict: false strict: false
},
middleware: ['redirect']
},
nitro: {
routeRules: {
'/**': { cors: true }
} }
}, },

@ -1,17 +1,17 @@
export default defineNuxtPlugin({ export default defineNuxtPlugin((nuxtApp) => {
name: 'router', const router = useRouter()
enforce: 'pre', const route = useRoute()
setup(nuxtApp) {
nuxtApp.vueApp.config.errorHandler = (error, instance, info) => { // Empêcher la redirection vers la racine
console.error('Vue Error:', error) router.beforeEach((to, from, next) => {
console.error('Component:', instance) const basePath = '/containers/matheothierry-portfolio_nuxt'
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
} }
nuxtApp.hook('vue:error', (error, instance, info) => { next()
console.error('Vue Error:', error)
console.error('Component:', instance)
console.error('Info:', info)
}) })
}
}) })
Loading…
Cancel
Save