Fix logout loop

This commit is contained in:
Tom Moor
2018-05-29 22:18:11 -07:00
parent 4a7f8d3895
commit 57aaea60da
2 changed files with 17 additions and 12 deletions

View File

@ -58,7 +58,9 @@ class AuthStore {
Cookie.remove('accessToken', { path: '/' });
await localForage.clear();
window.location.href = BASE_URL;
// add a timestamp to force reload from server
window.location.href = `${BASE_URL}?done=${new Date().getTime()}`;
};
@action
@ -127,6 +129,8 @@ class AuthStore {
// sessions created pre-google auth
this.token = Cookie.get('accessToken') || data.token;
if (this.token) setImmediate(() => this.fetch());
autorun(() => {
try {
localStorage.setItem(AUTH_STORE, this.asJson);