feat: 工作台页面和用户分页列表页面完善

This commit is contained in:
ray
2024-11-08 07:44:49 +08:00
parent 79639cfc1e
commit c8787b43cd
14 changed files with 336 additions and 171 deletions

47
src/api/auth/index.ts Normal file
View File

@@ -0,0 +1,47 @@
import request from "@/utils/request";
const AuthAPI = {
/**
* 登录接口
*
* @param username 用户名
* @param password 密码
* @returns 返回 token
*/
login(data: LoginFormData): Promise<LoginResult> {
console.log("data", data);
return request<LoginResult>({
url: "/api/v1/auth/login",
method: "POST",
data: data,
header: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
},
/**
* 登出接口
*/
logout(): Promise<void> {
return request({
url: "/api/v1/auth/logout",
method: "DELETE",
});
},
};
export default AuthAPI;
/** 登录响应 */
export interface LoginResult {
/** 访问token */
accessToken: string;
/** token 类型 */
tokenType?: string;
}
export interface LoginFormData {
username: string;
password: string;
}