优化,排查项目问题

This commit is contained in:
truewhile
2026-09-05 12:34:17 +08:00
parent 7fa05391e1
commit 1407b9b5c4
85 changed files with 1940 additions and 638 deletions
+7 -1
View File
@@ -16,6 +16,7 @@ export function AdminUsersPanel() {
const [maxUsers, setMaxUsers] = useState(DEFAULT_MAX_USERS)
const [maxUsersDraft, setMaxUsersDraft] = useState(String(DEFAULT_MAX_USERS))
const [savingLimit, setSavingLimit] = useState(false)
const [creating, setCreating] = useState(false)
const [username, setUsername] = useState('')
const [password, setPassword] = useState('')
const [editingID, setEditingID] = useState<string | null>(null)
@@ -69,18 +70,22 @@ export function AdminUsersPanel() {
const handleCreate = async (e: FormEvent) => {
e.preventDefault()
if (creating) return
setCreating(true)
try {
await adminAPI.createUser({ username, password })
toast.success('用户已添加,默认仅允许浏览与播放媒体')
setUsername('')
setPassword('')
await refresh()
} catch (err: unknown) {
const msg =
userCreateErrorMessage(err) ??
'添加用户失败'
toast.error(msg)
} finally {
setCreating(false)
}
await refresh().catch(() => undefined)
}
const startEdit = (u: User) => {
@@ -171,6 +176,7 @@ export function AdminUsersPanel() {
maxUsers={maxUsers}
maxUsersDraft={maxUsersDraft}
savingLimit={savingLimit}
creating={creating}
username={username}
password={password}
userLimitReached={userLimitReached}