feat: 完善平台总后台模块
This commit is contained in:
12
frontend/platform_admin/src/api/auth.ts
Normal file
12
frontend/platform_admin/src/api/auth.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { request } from './http';
|
||||
|
||||
/** 平台登录和当前账号资料的接口模型。 */
|
||||
export type LoginData = { username: string; password: string };
|
||||
export type LoginReply = { access_token: string; token_type: string; identity: string; display_name: string; role_code: string };
|
||||
export type Profile = { identity: string; username: string; display_name: string; avatar: string; role_code: string };
|
||||
|
||||
export const authApi = {
|
||||
login: (data: LoginData) => request<LoginReply>('/auth/login', { method: 'POST', body: JSON.stringify(data) }),
|
||||
profile: () => request<Profile>('/auth/profile'),
|
||||
changePassword: (currentPassword: string, newPassword: string) => request<{ changed: boolean }>('/auth/password', { method: 'PUT', body: JSON.stringify({ current_password: currentPassword, new_password: newPassword }) }),
|
||||
};
|
||||
Reference in New Issue
Block a user