登录调整1
This commit is contained in:
parent
a47a0730ea
commit
b7d16ed501
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user