From 0e4e89215293bbd43a021d3d8c120a46a6bd9ab5 Mon Sep 17 00:00:00 2001 From: Mutasem Date: Wed, 16 Nov 2022 13:54:18 +0100 Subject: [PATCH] fix: Fix user redirect to signin bug --- 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 d11702535d086..626e2624528ff 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 514d2c919f36f..dd78fe178200a 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) {