// 用户管理域 API(全部端点仅 admin 可用,后端 AdminAuth 兜底) import { http, buildQuery, type ListParams, type RequestOptions } from '../http'; import type { PageData, User } from '@/types'; export interface UserCreateInput { username: string; password: string; nickname?: string; role?: 'admin' | 'user'; } export const userApi = { list: (params: ListParams = {}, options?: RequestOptions) => http.get>(`/users${buildQuery(params)}`, options), create: (data: UserCreateInput) => http.post('/users', data), remove: (id: number) => http.delete<{ message: string }>(`/users/${id}`), // 管理员重置密码(后端会吊销目标用户全部旧会话) resetPassword: (id: number, newPassword: string) => http.post<{ message: string }>(`/users/${id}/reset-password`, { newPassword }), };