From b8531ad81635b931659af74f53324fee63869491 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 20 Mar 2021 17:04:09 +0100 Subject: [PATCH] [API] Fixed logout loop --- src/store/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 09eb430..21d53f5 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -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;