Remove client on logout
This commit is contained in:
parent
887328ee65
commit
d1c035d43a
|
|
@ -89,7 +89,15 @@ export class CurrentUser {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
public logout = () => {
|
public logout = async () => {
|
||||||
|
await axios
|
||||||
|
.get(config.get('url') + 'client')
|
||||||
|
.then((resp: AxiosResponse<IClient[]>) => {
|
||||||
|
resp.data.filter((client) => client.token === this.tokenCache).forEach((client) => {
|
||||||
|
return axios.delete(config.get('url') + 'client/' + client.id);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => Promise.resolve());
|
||||||
window.localStorage.removeItem(tokenKey);
|
window.localStorage.removeItem(tokenKey);
|
||||||
this.tokenCache = null;
|
this.tokenCache = null;
|
||||||
this.loggedIn = false;
|
this.loggedIn = false;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ const initStores = (): StoreMapping => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
stores.currentUser.tryAuthenticate();
|
stores.currentUser.tryAuthenticate().catch(() => {});
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<InjectProvider stores={stores}>
|
<InjectProvider stores={stores}>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue