// @ts-check import { defineStore } from "pinia"; export const useAppStore = defineStore({ id: "app", state: () => ({ _condition: typeof localStorage["condition"] == "undefined" ? "uninitialized" : localStorage["condition"], _lastView: typeof localStorage["lastView"] == "undefined" ? "/start" : localStorage["lastView"], _projectId: typeof localStorage.getItem("projectId") === "undefined" ? "" : localStorage.getItem("projectId"), }), getters: { condition: (state) => state._condition, projectId: (state): string => state._projectId as string, }, actions: { reset() { localStorage.removeItem("condition"); }, setCondition(newCondition: string) { localStorage.setItem("condition", newCondition); }, setProjectId(newProjectId: string) { localStorage.setItem("projectId", newProjectId); }, }, });