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: {
options: {
strict: false
},
middleware: ['redirect']
},
nitro: {
routeRules: {
'/**': { cors: true }
}
},

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