Fix: clear localstore after logout (#3731)

* fix: remove user, team, and policies from auth store and localstorage on logout

* true up the reset everywhere
This commit is contained in:
Nan Yu
2022-07-04 01:47:44 -07:00
committed by GitHub
parent 5d498632c6
commit f36f5f13f4

View File

@@ -204,6 +204,7 @@ export default class AuthStore {
runInAction("AuthStore#updateUser", () => {
this.user = null;
this.team = null;
this.policies = [];
this.token = null;
});
};
@@ -259,14 +260,6 @@ export default class AuthStore {
client.post(`/auth.delete`);
// remove user and team from localStorage
Storage.set(AUTH_STORE, {
user: null,
team: null,
policies: [],
});
this.token = null;
// if this logout was forced from an authenticated route then
// save the current path so we can go back there once signed in
if (savePath) {
@@ -290,7 +283,12 @@ export default class AuthStore {
setCookie("sessions", JSON.stringify(sessions), {
domain: getCookieDomain(window.location.hostname),
});
this.team = null;
}
// clear all credentials from cache (and local storage via autorun)
this.user = null;
this.team = null;
this.policies = [];
this.token = null;
};
}