forked from mosip/inji-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INJIWEB-977]: Fix storage.ts & Add comment in reduxMockUtils
Signed-off-by: Kamlesh Singh Bisht <[email protected]>
- Loading branch information
1 parent
f36ad03
commit afc1fc8
Showing
5 changed files
with
20 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
|
||
export class storage { | ||
static SESSION_INFO = "download_session"; | ||
static SELECTED_LANGUAGE = "selected_language"; | ||
|
||
static setItem = (key: string, value: string | null | undefined) => { | ||
if (value !== null && value !== undefined) { | ||
static SESSION_INFO = "download_session" | ||
static SELECTED_LANGUAGE = "selected_language" | ||
static setItem = (key: string, value: string) => { | ||
if (value) { | ||
localStorage.setItem(key, JSON.stringify(value)); | ||
} | ||
} | ||
|
||
static getItem = (key: string): string | null => { | ||
const data = localStorage.getItem(key); | ||
static getItem = (key: string) => { | ||
let data = localStorage.getItem(key); | ||
if (data) { | ||
try { | ||
return JSON.parse(data); | ||
} catch (error) { | ||
return null; | ||
} | ||
|
||
data = JSON.parse(data); | ||
} | ||
return null; | ||
return data; | ||
} | ||
} |