Skip to content

Commit

Permalink
Merge pull request outline#600 from outline/jori/fix-590
Browse files Browse the repository at this point in the history
Handle Safari paranoid mode
  • Loading branch information
tommoor authored Feb 18, 2018
2 parents b53749c + 8bfecae commit 3ea5573
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/stores/AuthStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,23 @@ class AuthStore {

constructor() {
// Rehydrate
const data = JSON.parse(localStorage.getItem(AUTH_STORE) || '{}');
let data = {};
try {
data = JSON.parse(localStorage.getItem(AUTH_STORE) || '{}');
} catch (_) {
// no-op Safari private mode
}
this.user = data.user;
this.team = data.team;
this.token = data.token;
this.oauthState = data.oauthState;

autorun(() => {
localStorage.setItem(AUTH_STORE, this.asJson);
try {
localStorage.setItem(AUTH_STORE, this.asJson);
} catch (_) {
// no-op Safari private mode
}
});
}
}
Expand Down

0 comments on commit 3ea5573

Please sign in to comment.