Skip to content

Commit

Permalink
fix: Handle Chrome errors when cookies are disabled (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
D1plo1d authored Jan 30, 2021
1 parent 5c4883b commit c05ddc0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/logic/storeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ class StoreFactory {
public middleWares: MiddleWare[] = [];

constructor(public name = STORE_DEFAULT_NAME) {
this.storageType =
typeof sessionStorage !== 'undefined'
? window.sessionStorage
: ({} as Storage);
try {
this.storageType =
typeof sessionStorage !== 'undefined'
? window.sessionStorage
: ({} as Storage);
} catch {
this.storageType = {} as Storage;
}
}

updateStore(defaultValues: GlobalState) {
Expand All @@ -23,4 +27,4 @@ class StoreFactory {
}
}

export default new StoreFactory();
export default new StoreFactory();

0 comments on commit c05ddc0

Please sign in to comment.