|
|
|
@ -20,7 +20,7 @@ import { login } from '@/service/modules/login'
|
|
|
|
|
import { getUserInfo } from '@/service/modules/users' |
|
|
|
|
import { useUserStore } from '@/store/user/user' |
|
|
|
|
import type { Router } from 'vue-router' |
|
|
|
|
import type { SessionIdRes } from '@/service/modules/login/types' |
|
|
|
|
import type { LoginRes } from '@/service/modules/login/types' |
|
|
|
|
import type { UserInfoRes } from '@/service/modules/users/types' |
|
|
|
|
import { useRouteStore } from '@/store/route/route' |
|
|
|
|
import { useTimezoneStore } from '@/store/timezone/timezone' |
|
|
|
@ -34,8 +34,9 @@ export function useLogin(state: any) {
|
|
|
|
|
const handleLogin = () => { |
|
|
|
|
state.loginFormRef.validate(async (valid: any) => { |
|
|
|
|
if (!valid) { |
|
|
|
|
const loginRes: SessionIdRes = await login({ ...state.loginForm }) |
|
|
|
|
const loginRes: LoginRes = await login({ ...state.loginForm }) |
|
|
|
|
await userStore.setSessionId(loginRes.sessionId) |
|
|
|
|
await userStore.setSecurityConfigType(loginRes.securityConfigType) |
|
|
|
|
|
|
|
|
|
const userInfoRes: UserInfoRes = await getUserInfo() |
|
|
|
|
await userStore.setUserInfo(userInfoRes) |
|
|
|
|