Download apps/web-naive/src/api/core/user-mgmt.ts from binhugg3/admin: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/binhugg3/admin/resolve/main/apps/web-naive/src/api/core/user-mgmt.ts
- Command line
-
hf download hf://spaces/binhugg3/admin/apps/web-naive/src/api/core/user-mgmt.ts
-
curl -L -o user-mgmt.ts https://huggingface.co/spaces/binhugg3/admin/resolve/main/apps/web-naive/src/api/core/user-mgmt.ts
1.21 kB
| import type { PaginatedList } from './types'; | |
| import { requestClient } from '#/api/request'; | |
| // ======================== 类型定义 ======================== | |
| export interface UserListParams { | |
| page?: number; | |
| page_size?: number; | |
| keyword?: string; | |
| } | |
| export interface UserItem { | |
| id: number; | |
| username: string; | |
| email: null | string; | |
| nickname: null | string; | |
| avatar: null | string; | |
| is_active: boolean; | |
| last_login_at: null | string; | |
| created_at: null | string; | |
| } | |
| // ======================== API ======================== | |
| /** 用户列表 GET /admin/user */ | |
| export function getUserListApi(params?: UserListParams) { | |
| return requestClient.get<PaginatedList<UserItem>>('/admin/user', { params }); | |
| } | |
| /** 用户详情 GET /admin/user/:id */ | |
| export function getUserDetailApi(userId: number) { | |
| return requestClient.get<UserItem>(`/admin/user/${userId}`); | |
| } | |
| /** 封禁/解封用户 PUT /admin/user/:id/ban */ | |
| export function toggleUserBanApi(userId: number) { | |
| return requestClient.put<{ is_active: boolean }>(`/admin/user/${userId}/ban`); | |
| } | |
| /** 删除用户 DELETE /admin/user/:id */ | |
| export function deleteUserApi(userId: number) { | |
| return requestClient.delete(`/admin/user/${userId}`); | |
| } | |