mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Testing set collection from local storage from layout.
This commit is contained in:
parent
6973c09b32
commit
d1089a36cb
2 changed files with 20 additions and 11 deletions
|
|
@ -6,7 +6,6 @@
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"package": "svelte-kit package",
|
"package": "svelte-kit package",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"prepare": "svelte-kit sync",
|
|
||||||
"test": "playwright test",
|
"test": "playwright test",
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
|
|
@ -50,4 +49,4 @@
|
||||||
"feather-icons": "^4.29.0",
|
"feather-icons": "^4.29.0",
|
||||||
"zod": "^3.17.10"
|
"zod": "^3.17.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,15 +12,25 @@
|
||||||
import '$root/styles/styles.scss';
|
import '$root/styles/styles.scss';
|
||||||
import Toast from '$lib/components/toast/Toast.svelte';
|
import Toast from '$lib/components/toast/Toast.svelte';
|
||||||
|
|
||||||
// let collectionEmpty = $collectionStore.length === 0 || false;
|
console.log('browser', browser);
|
||||||
// console.log('collectionEmpty', collectionEmpty);
|
if (browser) {
|
||||||
// if (browser && collectionEmpty) {
|
let collectionEmpty = $collectionStore.length === 0 || false;
|
||||||
// const collection = JSON.parse(localStorage.collection);
|
console.log('collectionEmpty', collectionEmpty);
|
||||||
// console.log('collection', collection);
|
console.log('localStorage.collection', localStorage.collection);
|
||||||
// if (collection && collection.length !== 0) {
|
if (
|
||||||
// collectionStore.addAll(collection);
|
browser &&
|
||||||
// }
|
collectionEmpty &&
|
||||||
// }
|
localStorage &&
|
||||||
|
localStorage.collection &&
|
||||||
|
localStorage.collection !== 0
|
||||||
|
) {
|
||||||
|
const collection = JSON.parse(localStorage.collection);
|
||||||
|
console.log('collection', collection);
|
||||||
|
if (collection && collection.length !== 0) {
|
||||||
|
collectionStore.addAll(collection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const dev = process.env.NODE_ENV !== 'production';
|
const dev = process.env.NODE_ENV !== 'production';
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue