Skip to content

Commit

Permalink
fix: check window is defined before using it (#962)
Browse files Browse the repository at this point in the history
  • Loading branch information
assimelha authored and benjie committed Sep 24, 2019
1 parent 7762c3d commit e4866ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/graphiql/src/utility/StorageAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

export default class StorageAPI {
constructor(storage) {
this.storage = storage || window.localStorage;
this.storage =
storage || (typeof window !== 'undefined' ? window.localStorage : null);
}

get(name) {
Expand Down

0 comments on commit e4866ad

Please sign in to comment.