fix(api): Session is required to load current user
This commit is contained in:
parent
8e552ba508
commit
9eb5412c14
|
@ -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;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue