fix(api): Load current user in login function of mainStore
This commit is contained in:
parent
e3856c77d4
commit
6652025143
|
@ -67,8 +67,10 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
async login(userid: string, password: string) {
|
async login(userid: string, password: string) {
|
||||||
|
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);
|
||||||
return true;
|
return true;
|
||||||
} catch ({ response }) {
|
} catch ({ response }) {
|
||||||
|
|
Loading…
Reference in New Issue