import { defineStore } from "pinia"; export const useStore = defineStore({ id: "counter", state: () => ({ language: "fr-FR", theme: "", }), persist: { enabled: true, }, actions: { switchLanguage() { this.language = this.language == "fr-FR" ? "en-US" : "fr-FR"; }, switchTheme() { if (this.theme == "") { this.theme = "dark"; document.body.classList.remove("theme-light"); document.body.classList.add("theme-dark"); } else if (this.theme == "dark") { this.theme = "light"; document.body.classList.remove("theme-dark"); document.body.classList.add("theme-light"); } else { this.theme = ""; document.body.classList.remove("theme-light"); document.body.classList.remove("theme-dark"); } }, }, });