From 83dc3fff96c509547b5b6d29d0c8a78e77a4c250 Mon Sep 17 00:00:00 2001 From: 37b7 Date: Tue, 20 May 2025 14:56:16 +0200 Subject: [PATCH] gzuioidjkclq --- middleware/redirect.ts | 11 ----------- nuxt.config.ts | 16 +--------------- package.json | 1 + plugins/router.ts | 30 +++++++++++++++--------------- 4 files changed, 17 insertions(+), 41 deletions(-) delete mode 100644 middleware/redirect.ts diff --git a/middleware/redirect.ts b/middleware/redirect.ts deleted file mode 100644 index 83c7cfe..0000000 --- a/middleware/redirect.ts +++ /dev/null @@ -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 }) -}) \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index cad0c80..42f820e 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -29,8 +29,7 @@ export default defineNuxtConfig({ } ], }, - baseURL: '/containers/matheothierry-portfolio_nuxt/', - cdnURL: 'https://codefirst.iut.uca.fr/containers/matheothierry-portfolio_nuxt/' + buildAssetsDir: '/containers/matheothierry-portfolio_nuxt/_nuxt/' }, modules: ['@nuxt/image'], @@ -40,19 +39,6 @@ export default defineNuxtConfig({ { src: '~/plugins/theme.ts', mode: 'client' } ], - router: { - options: { - strict: false - }, - middleware: ['redirect'] - }, - - nitro: { - routeRules: { - '/**': { cors: true } - } - }, - image: { provider: 'ipx', ssr: false, diff --git a/package.json b/package.json index c5bf797..ab62772 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "build": "nuxt build", "dev": "nuxt dev", + "start": "nuxt start", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare" diff --git a/plugins/router.ts b/plugins/router.ts index e99402e..fe21aa2 100644 --- a/plugins/router.ts +++ b/plugins/router.ts @@ -1,17 +1,17 @@ -export default defineNuxtPlugin((nuxtApp) => { - const router = useRouter() - const route = useRoute() - - // 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 +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) } - - next() - }) + + nuxtApp.hook('vue:error', (error, instance, info) => { + console.error('Vue Error:', error) + console.error('Component:', instance) + console.error('Info:', info) + }) + } }) \ No newline at end of file