diff --git a/ui/src/components/UserView.vue b/ui/src/components/UserView.vue
index e745bfd..11474a3 100644
--- a/ui/src/components/UserView.vue
+++ b/ui/src/components/UserView.vue
@@ -11,7 +11,6 @@
diff --git a/ui/src/components/admin/ConfigView.vue b/ui/src/components/admin/ConfigView.vue
index 4086b4a..8ea921e 100644
--- a/ui/src/components/admin/ConfigView.vue
+++ b/ui/src/components/admin/ConfigView.vue
@@ -38,7 +38,7 @@
Rätsel
- Offene Türchen
- - {{ num_user_doors }}
+ - {{ store.user_doors.length }}
- Zeit zum nächsten Türchen
-
@@ -217,7 +217,6 @@ export default class extends Vue {
},
};
public doors: DoorsSaved = [];
- public num_user_doors = 0;
public dav_credentials: Credentials = ["", ""];
public ui_credentials: Credentials = ["", ""];
@@ -232,12 +231,10 @@ export default class extends Vue {
Promise.all([
this.$advent22.api_get("admin/config_model"),
this.$advent22.api_get("admin/doors"),
- this.$advent22.api_get("user/doors"),
])
- .then(([admin_config_model, doors, user_doors]) => {
+ .then(([admin_config_model, doors]) => {
this.admin_config_model = admin_config_model;
this.doors = doors;
- this.num_user_doors = user_doors.length;
ready();
})
diff --git a/ui/src/plugins/store.ts b/ui/src/plugins/store.ts
index bcde90e..6d4b347 100644
--- a/ui/src/plugins/store.ts
+++ b/ui/src/plugins/store.ts
@@ -1,4 +1,4 @@
-import { Credentials, SiteConfigModel } from "@/lib/api";
+import { Credentials, DoorsSaved, SiteConfigModel } from "@/lib/api";
import { ADVENT22 } from "@/plugins/advent22";
import { AxiosBasicCredentials } from "axios";
import { acceptHMRUpdate, defineStore } from "pinia";
@@ -19,6 +19,7 @@ export const advent22Store = defineStore({
content: "",
footer: "",
} as SiteConfigModel,
+ user_doors: [] as DoorsSaved,
next_door_target: null as number | null,
}),
@@ -47,15 +48,18 @@ export const advent22Store = defineStore({
Promise.all([
ADVENT22.api_get("user/site_config"),
+ ADVENT22.api_get("user/doors"),
ADVENT22.api_get("user/next_door"),
])
- .then(([site_config, next_door]) => {
+ .then(([site_config, user_doors, next_door]) => {
document.title = site_config.title;
if (site_config.subtitle !== "")
document.title += " – " + site_config.subtitle;
this.site_config = site_config;
+ this.user_doors = user_doors;
+
if (next_door !== null)
this.next_door_target = Date.now() + next_door;
})