零 Node 部署、超级管理员,并完善本地构建发布文档。
- FastAPI 单进程托管 frontend/dist,systemd 替代 PM2 - 超级管理员 admin、注册开关与用户管理 - README/DEPLOY/USAGE 说明:改代码须本地构建 dist 后 push,服务器 update.sh - 提交 frontend/dist 与 build-frontend 脚本
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import axios from 'axios'
|
||||
import type {
|
||||
AdminUser,
|
||||
Exam,
|
||||
PublicSettings,
|
||||
ScoreInput,
|
||||
SchoolLevel,
|
||||
Student,
|
||||
Subject,
|
||||
SystemSettings,
|
||||
TokenResponse,
|
||||
TrendResponse,
|
||||
User,
|
||||
@@ -59,6 +62,27 @@ export const authApi = {
|
||||
me: () => api.get<User>('/auth/me'),
|
||||
}
|
||||
|
||||
export const settingsApi = {
|
||||
public: () => api.get<PublicSettings>('/settings/public'),
|
||||
}
|
||||
|
||||
export const adminApi = {
|
||||
getSettings: () => api.get<SystemSettings>('/admin/settings'),
|
||||
updateSettings: (data: { registration_enabled?: boolean }) =>
|
||||
api.patch<SystemSettings>('/admin/settings', data),
|
||||
updateProfile: (data: {
|
||||
username?: string
|
||||
current_password?: string
|
||||
password?: string
|
||||
}) => api.patch<AdminUser>('/admin/profile', data),
|
||||
listUsers: () => api.get<AdminUser[]>('/admin/users'),
|
||||
createUser: (data: { username: string; password: string }) =>
|
||||
api.post<AdminUser>('/admin/users', data),
|
||||
resetUserPassword: (id: string, password: string) =>
|
||||
api.patch<AdminUser>(`/admin/users/${id}`, { password }),
|
||||
deleteUser: (id: string) => api.delete(`/admin/users/${id}`),
|
||||
}
|
||||
|
||||
export const studentApi = {
|
||||
list: () => api.get<Student[]>('/students'),
|
||||
create: (data: {
|
||||
|
||||
Reference in New Issue
Block a user