mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 09:50:21 +08:00
perf(frontend): 管理页面更新操作改为局部刷新,避免全量重载列表
Provider、API Key、Pool Key、Management Token 的更新操作 完成后直接替换本地列表中对应记录,仅创建操作保留全量刷新。
This commit is contained in:
@@ -691,12 +691,18 @@ async function saveToken() {
|
||||
|
||||
if (editingToken.value) {
|
||||
// 更新
|
||||
await managementTokenApi.updateToken(editingToken.value.id, {
|
||||
const tokenId = editingToken.value.id
|
||||
const result = await managementTokenApi.updateToken(tokenId, {
|
||||
name: formData.name,
|
||||
description: formData.description.trim() || null,
|
||||
allowed_ips: allowedIps.length > 0 ? allowedIps : null,
|
||||
expires_at: expiresAtUtc
|
||||
})
|
||||
// 局部更新:直接替换列表中对应的记录
|
||||
const index = tokens.value.findIndex(t => t.id === tokenId)
|
||||
if (index !== -1) {
|
||||
tokens.value[index] = result.data
|
||||
}
|
||||
success('令牌更新成功')
|
||||
} else {
|
||||
// 创建
|
||||
@@ -710,10 +716,10 @@ async function saveToken() {
|
||||
isRegenerating.value = false
|
||||
showTokenDialog.value = true
|
||||
success('令牌创建成功')
|
||||
await loadTokens()
|
||||
}
|
||||
|
||||
closeDialog()
|
||||
await loadTokens()
|
||||
} catch (err: unknown) {
|
||||
log.error('保存 Token 失败:', err)
|
||||
showError(parseApiError(err, '保存失败'))
|
||||
|
||||
Reference in New Issue
Block a user