From acf233a77b7e1b77bd352a7f4eeab4ce7f7d2629 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 10 Sep 2020 13:54:59 +0200 Subject: [PATCH] copy, window check --- src/components/molecules/UserPreferences/Debug.tsx | 2 +- src/providers/UserPreferences.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/UserPreferences/Debug.tsx b/src/components/molecules/UserPreferences/Debug.tsx index eb57c6e88..1615b7fb4 100644 --- a/src/components/molecules/UserPreferences/Debug.tsx +++ b/src/components/molecules/UserPreferences/Debug.tsx @@ -15,7 +15,7 @@ export default function Debug(): ReactElement { defaultChecked={debug === true} onChange={() => setDebug(!debug)} /> - Show geeky debug information in some places. + Show geeky information in some places. ) } diff --git a/src/providers/UserPreferences.tsx b/src/providers/UserPreferences.tsx index 4fc5ed276..ef5b9267a 100644 --- a/src/providers/UserPreferences.tsx +++ b/src/providers/UserPreferences.tsx @@ -22,14 +22,14 @@ const localStorageKey = 'ocean-user-preferences' function getLocalStorage() { const storageParsed = - window !== undefined && + typeof window !== undefined && JSON.parse(window.localStorage.getItem(localStorageKey)) return storageParsed } function setLocalStorage(values: UserPreferencesValue) { return ( - window !== undefined && + typeof window !== undefined && window.localStorage.setItem(localStorageKey, JSON.stringify(values)) ) }