mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-22 15:53:01 +00:00
store.user_doors handling
This commit is contained in:
parent
9e303f898a
commit
223cc584a7
2 changed files with 8 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<template v-if="store.user_doors.length > 0">
|
||||
<Calendar :doors="doors" />
|
||||
<Calendar :doors="store.user_doors" />
|
||||
<hr />
|
||||
<div class="content" v-html="store.site_config.content" />
|
||||
<div class="content has-text-primary">
|
||||
|
@ -17,7 +17,6 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Door } from "@/lib/door";
|
||||
import { advent22Store } from "@/plugins/store";
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
|
@ -32,15 +31,5 @@ import CountDown from "./CountDown.vue";
|
|||
})
|
||||
export default class extends Vue {
|
||||
public readonly store = advent22Store();
|
||||
|
||||
public get doors(): Door[] {
|
||||
const result = [];
|
||||
|
||||
for (const value of this.store.user_doors) {
|
||||
result.push(Door.load(value));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Credentials, DoorSaved, SiteConfigModel } from "@/lib/api";
|
||||
import { Door } from "@/lib/door";
|
||||
import { Advent22 } from "@/plugins/advent22";
|
||||
import { RemovableRef, useLocalStorage } from "@vueuse/core";
|
||||
import { AxiosBasicCredentials } from "axios";
|
||||
|
@ -17,7 +18,7 @@ type State = {
|
|||
is_admin: boolean;
|
||||
site_config: SiteConfigModel;
|
||||
calendar_aspect_ratio: number;
|
||||
user_doors: DoorSaved[];
|
||||
user_doors: Door[];
|
||||
next_door_target: number | null;
|
||||
};
|
||||
|
||||
|
@ -82,7 +83,11 @@ export const advent22Store = defineStore({
|
|||
document.title += " – " + site_config.subtitle;
|
||||
|
||||
this.site_config = site_config;
|
||||
this.user_doors = user_doors;
|
||||
|
||||
this.user_doors.length = 0;
|
||||
for (const door_saved of user_doors) {
|
||||
this.user_doors.push(Door.load(door_saved));
|
||||
}
|
||||
|
||||
if (next_door !== null)
|
||||
this.next_door_target = Date.now() + next_door;
|
||||
|
|
Loading…
Reference in a new issue