diff options
Diffstat (limited to 'src/stores')
| -rw-r--r-- | src/stores/anime.ts | 16 | ||||
| -rw-r--r-- | src/stores/manga.ts | 16 |
2 files changed, 4 insertions, 28 deletions
diff --git a/src/stores/anime.ts b/src/stores/anime.ts index dd85588d..116139a3 100644 --- a/src/stores/anime.ts +++ b/src/stores/anime.ts @@ -1,17 +1,5 @@ -import { browser } from '$app/environment'; -import { writable } from 'svelte/store'; -import localforage from 'localforage'; +import { persistentStore } from '$lib/Utility/persistentStore'; -const anime = writable<string>(''); - -if (browser) { - localforage.getItem<string>('anime').then((value) => { - if (value) anime.set(value); - }); - - anime.subscribe((value) => { - localforage.setItem('anime', value); - }); -} +const anime = persistentStore<string>('anime', ''); export default anime; diff --git a/src/stores/manga.ts b/src/stores/manga.ts index ff61d335..84b19665 100644 --- a/src/stores/manga.ts +++ b/src/stores/manga.ts @@ -1,17 +1,5 @@ -import { browser } from '$app/environment'; -import { writable } from 'svelte/store'; -import localforage from 'localforage'; +import { persistentStore } from '$lib/Utility/persistentStore'; -const manga = writable<string>(''); - -if (browser) { - localforage.getItem<string>('manga').then((value) => { - if (value) manga.set(value); - }); - - manga.subscribe((value) => { - localforage.setItem('manga', value); - }); -} +const manga = persistentStore<string>('manga', ''); export default manga; |