mirror of
https://github.com/BlueMap-Minecraft/BlueMapVue.git
synced 2025-02-05 12:51:19 +01:00
Fix local storage not handling null-values correctly
This commit is contained in:
parent
ed67de14fe
commit
df3676c5c9
@ -13,6 +13,10 @@ export const setLocalStorage = (key, value) => {
|
||||
export const getLocalStorage = key => {
|
||||
const value = localStorage.getItem(key);
|
||||
|
||||
// return undefined for not defined values
|
||||
// because "null" might be ambiguous if there is actually "null" stored for that key
|
||||
if (value == null) return undefined;
|
||||
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch(e) {
|
||||
|
Loading…
Reference in New Issue
Block a user