mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-18 01:42:26 +01:00
fix:#18 reroute for default page only applies to empty paths
This commit is contained in:
@@ -23,7 +23,7 @@ const settingsStore = defineStore("settingsStore", {
|
||||
return {
|
||||
locale: useLocalStorage("locale", "en"), //useLocalStorage takes in a key of 'count' and default value of 0
|
||||
isDark: true,
|
||||
defaultPage: useLocalStorage("defaultPage", ""),
|
||||
defaultPage: useLocalStorage("defaultPage", {label: "Home", value: "/home"}),
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
@@ -36,19 +36,31 @@ const settingsStore = defineStore("settingsStore", {
|
||||
getDarkMode(): boolean {
|
||||
return this.isDark;
|
||||
},
|
||||
setDefaultPage(page: string) {
|
||||
setDefaultPage(page: {
|
||||
label: string;
|
||||
value: string;
|
||||
}) {
|
||||
this.defaultPage = page;
|
||||
},
|
||||
getDefaultPageOptions(): string[] {
|
||||
getDefaultPageOptions(): {
|
||||
label: string;
|
||||
value: string;
|
||||
}[] {
|
||||
// get a string array of all the route names
|
||||
const options: string[] = [];
|
||||
const options: {
|
||||
label: string;
|
||||
value: string;
|
||||
}[] = [];
|
||||
router.getRoutes().forEach((route) => {
|
||||
if (route.name) {
|
||||
if (typeof route.name === "string") {
|
||||
options.push(route.name);
|
||||
options.push({
|
||||
label: route.name,
|
||||
value: route.path,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return options;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user