fix(api): Session is required to load current user

This commit is contained in:
Ferdinand Thiessen 2021-12-05 20:51:44 +01:00
parent 8e552ba508
commit 9eb5412c14
1 changed files with 2 additions and 1 deletions

View File

@ -70,10 +70,11 @@ export const useMainStore = defineStore({
const userStore = useUserStore(); const userStore = useUserStore();
try { try {
const { data } = await api.post<FG.Session>('/auth', { userid, password }); const { data } = await api.post<FG.Session>('/auth', { userid, password });
this.user = await userStore.getUser(data.userid, true);
this.session = fixSession(data); this.session = fixSession(data);
this.user = await userStore.getUser(data.userid, true);
return true; return true;
} catch ({ response }) { } catch ({ response }) {
this.handleLoggedOut();
return (<AxiosResponse | undefined>response)?.status || false; return (<AxiosResponse | undefined>response)?.status || false;
} }
}, },