feat:#45 fix wrong use of redirect

This commit is contained in:
survellow
2024-07-03 19:28:34 +02:00
parent 2af1943733
commit 5d01ccf3ba
2 changed files with 16 additions and 6 deletions

View File

@@ -74,6 +74,16 @@ export const createApp = ViteSSG(
router = ctx.router;
router.beforeEach(async (to, from) => {
if (import.meta.env.SSR) {
return;
}
// External redirect
if (to.matched.some((record) => record.meta.redirect)) {
window.location.replace(to.meta.redirect as string);
return;
}
const newLocale = to.params.locale;
const prevLocale = from.params.locale;
// If the locale hasn't changed, do nothing
@@ -93,8 +103,6 @@ export const createApp = ViteSSG(
},
});
//app.config.globalProperties.$hostname = "https://cal.htwk-leipzig.de"
app.use(router);
app.use(ToastService);
app.use(DialogService);