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('/auth/login', { method: 'POST', body: JSON.stringify(data) }), profile: () => request('/auth/profile'), changePassword: (currentPassword: string, newPassword: string) => request<{ changed: boolean }>('/auth/password', { method: 'PUT', body: JSON.stringify({ current_password: currentPassword, new_password: newPassword }) }), };