From 2aac51a018741a1b4b38d87a4ecea4fdc854a1e7 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Sun, 19 May 2024 18:44:37 +0200 Subject: [PATCH] Feat: add persistentSettingsStore using LocalStorage plugin --- helpers/settingsCookies.ts | 10 ---------- stores/settingsStore.ts | 18 +++--------------- 2 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 helpers/settingsCookies.ts diff --git a/helpers/settingsCookies.ts b/helpers/settingsCookies.ts deleted file mode 100644 index 85eb841..0000000 --- a/helpers/settingsCookies.ts +++ /dev/null @@ -1,10 +0,0 @@ -const CARDS_COOKIE_NAME = 'cards_type'; -const CARDS_DEFAULT_VALUE = 'heron'; - -export function getCardsType(): CookieRef { - const cookie = useCookie(CARDS_COOKIE_NAME) - if (!cookie.value) { - cookie.value = CARDS_DEFAULT_VALUE; - } - return cookie; -} \ No newline at end of file diff --git a/stores/settingsStore.ts b/stores/settingsStore.ts index aa9353f..876f28f 100644 --- a/stores/settingsStore.ts +++ b/stores/settingsStore.ts @@ -3,24 +3,12 @@ import { defineStore } from "pinia"; const CARDS_COOKIE_NAME = 'cards_type'; const CARDS_DEFAULT_VALUE = 'heron'; -export function getCardsType(): ReturnType{ - const cookie = useCookie(CARDS_COOKIE_NAME) - if (!cookie.value) { - cookie.value = CARDS_DEFAULT_VALUE; - } - return cookie; -} export const useSettingsStore = defineStore("settingstore", { state: () => ({ - cardStyle: "heron" as string, + cardStyle: "heron", + shaderQuality: 6, + shaderFramerate: 60, }), - - actions: { - changeCardStyle(style: string) { - this.cardStyle = style; - getCardsType().value = style; - } - }, persist: true });