Skip to content

Commit

Permalink
fix: Fix user redirect to signin bug (#4623)
Browse files Browse the repository at this point in the history
  • Loading branch information
mutdmour authored Nov 16, 2022
1 parent b4cec38 commit 402b75a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/editor-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export default mixins(
throw e;
}
},
loginWithCookie(): void {
async loginWithCookie(): Promise<void> {
try {
this.usersStore.loginWithCookie();
await this.usersStore.loginWithCookie();
} catch (e) {}
},
async initTemplates(): Promise<void> {
Expand Down
6 changes: 4 additions & 2 deletions packages/editor-ui/src/stores/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,17 @@ export const useUsersStore = defineStore(STORES.USERS, {
}
Vue.set(this.currentUser, 'personalizationAnswers', answers);
},
async getCurrentUser(): void {
async getCurrentUser(): Promise<IUserResponse | null> {
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<void> {
const rootStore = useRootStore();
const user = await loginCurrentUser(rootStore.getRestApiContext);
if (user) {
Expand Down

0 comments on commit 402b75a

Please sign in to comment.