mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-07 04:09:17 +02:00
feat:#45 fix wrong use of redirect
This commit is contained in:
@@ -74,6 +74,16 @@ export const createApp = ViteSSG(
|
|||||||
router = ctx.router;
|
router = ctx.router;
|
||||||
|
|
||||||
router.beforeEach(async (to, from) => {
|
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 newLocale = to.params.locale;
|
||||||
const prevLocale = from.params.locale;
|
const prevLocale = from.params.locale;
|
||||||
// If the locale hasn't changed, do nothing
|
// 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(router);
|
||||||
app.use(ToastService);
|
app.use(ToastService);
|
||||||
app.use(DialogService);
|
app.use(DialogService);
|
||||||
|
@@ -112,17 +112,19 @@ const routes : RouterOptions = {
|
|||||||
{
|
{
|
||||||
path: "/privacy-policy",
|
path: "/privacy-policy",
|
||||||
name: "privacy-policy",
|
name: "privacy-policy",
|
||||||
redirect: "https://www.htwk-leipzig.de/hochschule/kontakt/datenschutzerklaerung/",
|
component: {},
|
||||||
meta: {
|
meta: {
|
||||||
label: "privacy"
|
label: "privacy",
|
||||||
|
redirect: "https://www.htwk-leipzig.de/hochschule/kontakt/datenschutzerklaerung/",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/imprint",
|
path: "/imprint",
|
||||||
name: "imprint",
|
name: "imprint",
|
||||||
redirect: "https://www.htwk-leipzig.de/hochschule/kontakt/impressum/",
|
component: {},
|
||||||
meta: {
|
meta: {
|
||||||
label: "imprint"
|
label: "imprint",
|
||||||
|
redirect: "https://www.htwk-leipzig.de/hochschule/kontakt/impressum/",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user