fix: Fix user redirect to signin bug (#4623)

This commit is contained in:
Mutasem Aldmour 2022-11-16 14:21:49 +01:00 committed by GitHub
parent b4cec38ee8
commit 402b75ac28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -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> {

View file

@ -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) {