fix(ui): проверять ревизии и сохранять ошибки истории
This commit is contained in:
1 parent
46d62c98b8
commit
4a8d696e4e
11 files changed
+183
-98
No files matched your search
@@ -61,7 +61,7 @@ import {
|
||||
type ServerTileItem,
|
||||
} from "@/components/server-tile-rail"
|
||||
import { ConfigHistorySheet } from "@/components/config-history-sheet"
|
||||
import type { ConfigRevisionDto } from "@/lib/config-revisions"
|
||||
import { parseConfigRevisions, type ConfigRevisionDto } from "@/lib/config-revisions"
|
||||
import { toast } from "sonner"
|
||||
import { findFreePoolIp } from "@/lib/ipsec-client"
|
||||
import {
|
||||
@@ -255,13 +255,12 @@ export default function IpsecPage() {
|
||||
setHistoryLoading(true)
|
||||
setHistoryError(null)
|
||||
try {
|
||||
const res = await requestJson<{ revisions: ConfigRevisionDto[] }>(
|
||||
const res = await requestJson<unknown>(
|
||||
backendUrl,
|
||||
`/api/ipsec/revisions?serverId=${encodeURIComponent(historyServerId)}`,
|
||||
)
|
||||
if (epoch !== historyEpoch.current) return
|
||||
if (!Array.isArray(res?.revisions)) throw new Error("Некорректный ответ истории IPsec")
|
||||
setRevisions(res.revisions)
|
||||
setRevisions(parseConfigRevisions(res, historyServerId, "ipsec"))
|
||||
} catch (err) {
|
||||
if (epoch !== historyEpoch.current) return
|
||||
setHistoryError(err instanceof Error ? err.message : "Не удалось загрузить историю")
|
||||
|
||||
Reference in new issue
Block a user