登录调整1

This commit is contained in:
fan 2023-07-31 15:46:57 +08:00
parent a47a0730ea
commit b7d16ed501
2 changed files with 2 additions and 8 deletions

View File

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

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) {