ruoyi-plus-vben5/apps/web-naive/src/api/core/auth.ts

34 lines
673 B
TypeScript
Raw Normal View History

2024-07-31 00:19:17 +08:00
import { requestClient } from '#/api/request';
export namespace AuthApi {
/** 登录接口参数 */
export interface LoginParams {
password: string;
username: string;
}
/** 登录接口返回值 */
export interface LoginResult {
accessToken: string;
desc: string;
realName: string;
refreshToken: string;
userId: string;
username: string;
}
}
/**
*
*/
2024-08-07 13:42:33 +08:00
export async function loginApi(data: AuthApi.LoginParams) {
2024-07-31 00:19:17 +08:00
return requestClient.post<AuthApi.LoginResult>('/auth/login', data);
}
/**
*
*/
2024-08-07 13:42:33 +08:00
export async function getAccessCodesApi() {
2024-07-31 00:19:17 +08:00
return requestClient.get<string[]>('/auth/codes');
}