mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
undefined is hard
This commit is contained in:
parent
e421667941
commit
69afec8511
@ -20,14 +20,14 @@ const localStorageKey = 'ocean-user-preferences'
|
|||||||
|
|
||||||
function getLocalStorage() {
|
function getLocalStorage() {
|
||||||
const storageParsed =
|
const storageParsed =
|
||||||
typeof window !== undefined &&
|
typeof window !== 'undefined' &&
|
||||||
JSON.parse(window.localStorage.getItem(localStorageKey))
|
JSON.parse(window.localStorage.getItem(localStorageKey))
|
||||||
return storageParsed
|
return storageParsed
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLocalStorage(values: UserPreferencesValue) {
|
function setLocalStorage(values: UserPreferencesValue) {
|
||||||
return (
|
return (
|
||||||
typeof window !== undefined &&
|
typeof window !== 'undefined' &&
|
||||||
window.localStorage.setItem(localStorageKey, JSON.stringify(values))
|
window.localStorage.setItem(localStorageKey, JSON.stringify(values))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user