Merge pull request #600 from outline/jori/fix-590
Handle Safari paranoid mode
This commit is contained in:
@@ -105,14 +105,23 @@ class AuthStore {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// Rehydrate
|
// 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.user = data.user;
|
||||||
this.team = data.team;
|
this.team = data.team;
|
||||||
this.token = data.token;
|
this.token = data.token;
|
||||||
this.oauthState = data.oauthState;
|
this.oauthState = data.oauthState;
|
||||||
|
|
||||||
autorun(() => {
|
autorun(() => {
|
||||||
localStorage.setItem(AUTH_STORE, this.asJson);
|
try {
|
||||||
|
localStorage.setItem(AUTH_STORE, this.asJson);
|
||||||
|
} catch (_) {
|
||||||
|
// no-op Safari private mode
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user