From 402b75ac280cf74df30aaf758f1c0a15762ad996 Mon Sep 17 00:00:00 2001 From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com> Date: Wed, 16 Nov 2022 14:21:49 +0100 Subject: [PATCH] fix: Fix user redirect to signin bug (#4623) --- packages/editor-ui/src/App.vue | 4 ++-- packages/editor-ui/src/stores/users.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/editor-ui/src/App.vue b/packages/editor-ui/src/App.vue index d11702535d..626e262452 100644 --- a/packages/editor-ui/src/App.vue +++ b/packages/editor-ui/src/App.vue @@ -91,9 +91,9 @@ export default mixins( throw e; } }, - loginWithCookie(): void { + async loginWithCookie(): Promise { try { - this.usersStore.loginWithCookie(); + await this.usersStore.loginWithCookie(); } catch (e) {} }, async initTemplates(): Promise { diff --git a/packages/editor-ui/src/stores/users.ts b/packages/editor-ui/src/stores/users.ts index 514d2c919f..dd78fe1782 100644 --- a/packages/editor-ui/src/stores/users.ts +++ b/packages/editor-ui/src/stores/users.ts @@ -86,15 +86,17 @@ export const useUsersStore = defineStore(STORES.USERS, { } Vue.set(this.currentUser, 'personalizationAnswers', answers); }, - async getCurrentUser(): void { + async getCurrentUser(): Promise { const rootStore = useRootStore(); const user = await getCurrentUser(rootStore.getRestApiContext); if (user) { this.addUsers([user]); this.currentUserId = user.id; } + + return user; }, - async loginWithCookie(): void { + async loginWithCookie(): Promise { const rootStore = useRootStore(); const user = await loginCurrentUser(rootStore.getRestApiContext); if (user) {