Local storage fallback

This commit is contained in:
Romein van Buren 2022-07-13 12:10:20 +02:00
parent ba0687af94
commit 0c88920f9e
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
2 changed files with 12 additions and 2 deletions

View File

@ -19,7 +19,17 @@ function createSettingsStore() {
s.set(val);
}
updateStorage(JSON.parse(window.localStorage.getItem('statusdash')));
const localStorageString = window.localStorage.getItem('statusdash');
let localStorage = {};
try {
localStorage = JSON.parse(localStorageString);
}
catch {
localStorage = {};
}
updateStorage(localStorage);
return {
subscribe: s.subscribe,

View File

@ -40,7 +40,7 @@ async function build() {
});
const { output } = await bundle.generate({
sourcemap: false,
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/build/bundle.js',