[API] Fixed logout loop

This commit is contained in:
Ferdinand Thiessen 2021-03-20 17:04:09 +01:00
parent 73a5de021d
commit b8531ad816
1 changed files with 5 additions and 4 deletions

View File

@ -94,14 +94,15 @@ export const useMainStore = defineStore({
LocalStorage.clear();
try {
await api.delete(`/auth/${this.session.token}`);
} catch (error) {
return false;
} finally {
const token = this.session.token;
this.$patch({
session: undefined,
user: undefined,
});
await api.delete(`/auth/${token}`);
} catch (error) {
return false;
} finally {
SessionStorage.clear();
}
return true;