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",
|
||||
"package": "svelte-kit package",
|
||||
"preview": "vite preview",
|
||||
"prepare": "svelte-kit sync",
|
||||
"test": "playwright test",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
|
|
@ -50,4 +49,4 @@
|
|||
"feather-icons": "^4.29.0",
|
||||
"zod": "^3.17.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,15 +12,25 @@
|
|||
import '$root/styles/styles.scss';
|
||||
import Toast from '$lib/components/toast/Toast.svelte';
|
||||
|
||||
// let collectionEmpty = $collectionStore.length === 0 || false;
|
||||
// console.log('collectionEmpty', collectionEmpty);
|
||||
// if (browser && collectionEmpty) {
|
||||
// const collection = JSON.parse(localStorage.collection);
|
||||
// console.log('collection', collection);
|
||||
// if (collection && collection.length !== 0) {
|
||||
// collectionStore.addAll(collection);
|
||||
// }
|
||||
// }
|
||||
console.log('browser', browser);
|
||||
if (browser) {
|
||||
let collectionEmpty = $collectionStore.length === 0 || false;
|
||||
console.log('collectionEmpty', collectionEmpty);
|
||||
console.log('localStorage.collection', localStorage.collection);
|
||||
if (
|
||||
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';
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue