mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-17 22:42:25 +01:00
feat:#4 added persistent storage option
This commit is contained in:
@@ -56,12 +56,15 @@ import Calendar from "primevue/calendar";
|
||||
import i18n from "./i18n";
|
||||
import { VueQueryPlugin } from "@tanstack/vue-query";
|
||||
import { polyfillCountryFlagEmojis } from "country-flag-emoji-polyfill";
|
||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||
|
||||
polyfillCountryFlagEmojis();
|
||||
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
|
||||
pinia.use(piniaPluginPersistedstate)
|
||||
|
||||
app.use(VueQueryPlugin, {
|
||||
queryClientConfig: {
|
||||
defaultOptions: {
|
||||
|
||||
@@ -20,6 +20,7 @@ const tokenStore = defineStore("tokenStore", {
|
||||
state: () => ({
|
||||
token: "",
|
||||
}),
|
||||
persist: true,
|
||||
actions: {
|
||||
setToken(token: string) {
|
||||
this.token = token;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import CalendarViewer from "@/components/CalendarViewer.vue";
|
||||
import DynamicPage from "@/view/DynamicPage.vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { extractToken } from "@/helpers/token.ts";
|
||||
import { useToast } from "primevue/usetoast";
|
||||
import moduleStore from "@/store/moduleStore.ts";
|
||||
@@ -41,6 +41,11 @@ function loadCalendar() {
|
||||
tokenStore().setToken(token.value);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (token.value && token.value !== "") {
|
||||
loadCalendar();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user