Skip to content

Commit

Permalink
Fix: Error when loading Session
Browse files Browse the repository at this point in the history
  • Loading branch information
TeraNovaLP committed Mar 12, 2021
1 parent bd6a2c3 commit 965c675
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kogitte",
"description": "OAuth2 session manager",
"version": "5.1.0",
"version": "5.1.1",
"license": "MPL-2.0",
"main": "dist/index.js",
"module": "dist/index.module.js",
Expand Down
8 changes: 5 additions & 3 deletions src/UserSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ export default class UserSession {
public static RefreshInProgress: boolean = false;

public static getSavedSession(): AuthData | null {
const json = localStorage.getItem(AuthConfig.config.localStorageKey);
if (AuthConfig.config?.localStorageKey) {
const json = localStorage.getItem(AuthConfig.config.localStorageKey);

if (json) {
return JSON.parse(json) as AuthData;
if (json) {
return JSON.parse(json) as AuthData;
}
}

return null;
Expand Down

0 comments on commit 965c675

Please sign in to comment.