diff --git a/src/main.ts b/src/main.ts index 01814f6..738a079 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,6 @@ import { createPinia } from "pinia"; import { createApp } from "vue"; +import { useAppStore } from "./store/app"; import App from "./App.vue"; import "./registerServiceWorker"; import router from "./router"; diff --git a/src/store/app.ts b/src/store/app.ts new file mode 100644 index 0000000..364adae --- /dev/null +++ b/src/store/app.ts @@ -0,0 +1,21 @@ +// @ts-check +import { defineStore } from "pinia"; + +export const useAppStore = defineStore({ + id: "account", + state: () => ({ + condition: JSON.parse( + typeof localStorage["app_condition"] == "undefined" + ? "uninitialized" + : localStorage["app_condition"] + ), + }), + getters: { + condition: (state) => state.condition, + }, + actions: { + reset() { + localStorage.removeItem("app_condition"); + }, + }, +});