mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
web/preferences: fix saving deletions to localstorage
This commit is contained in:
parent
3b05d14fbd
commit
a3873643ec
1 changed files with 2 additions and 0 deletions
|
@ -54,6 +54,8 @@ export function getLocalStoragePreferences(localStorageKey: string, onChange: ()
|
||||||
delete target[key]
|
delete target[key]
|
||||||
if (Object.keys(target).length === 0) {
|
if (Object.keys(target).length === 0) {
|
||||||
localStorage.removeItem(localStorageKey)
|
localStorage.removeItem(localStorageKey)
|
||||||
|
} else {
|
||||||
|
localStorage.setItem(localStorageKey, JSON.stringify(target))
|
||||||
}
|
}
|
||||||
onChange()
|
onChange()
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Add table
Reference in a new issue