登录接口返回调整

This commit is contained in:
dong 2023-07-31 10:40:25 +08:00
parent ce04e7694a
commit 52f8258753
2 changed files with 8 additions and 2 deletions

View File

@ -42,12 +42,18 @@ interface LoginInfo {
password: string;
}
interface LoginRes {
code: number;
expire: string;
token: string;
}
/**
*
* @param loginInfo
* @returns
*/
export async function login(loginInfo: LoginInfo): Promise<string> {
export async function login(loginInfo: LoginInfo): Promise<LoginRes> {
const info = { ...loginInfo, password: encryptPassword(loginInfo.password) };
const response = await api.post(`${UserUriBase}/login`, info);
return response.data;

View File

@ -70,7 +70,7 @@ const loginInfo = reactive({
async function doLogin() {
try {
clearJwtToken();
const token = await login(loginInfo);
const { token } = await login(loginInfo);
saveJwtToken(token);
router.push({ name: 'home' });
} catch (err) {