fix(ui): подтверждать удаление объектов IPsec

This commit is contained in:
Denozordec committed 2026-09-29 19:28:26 +07:00
1 parent 74e7cd257d
commit 611f31875e
6 files changed
+113 -49

No files matched your search

+12 -4
View File
@@ -44,11 +44,13 @@ export async function deleteIpsecServer(
const q = new URLSearchParams()
if (opts?.removeCertificates === false) q.set("removeCertificates", "false")
const suffix = q.size > 0 ? `?${q.toString()}` : ""
return requestJson<{ ok: boolean }>(
const result = await requestJson<{ ok: boolean }>(
baseUrl,
`/api/ipsec/server/${encodeURIComponent(serverId)}${suffix}`,
{ method: "DELETE" },
)
if (result?.ok !== true) throw new Error("Сервер не подтвердил удаление")
return result
}
export async function createIpsecUser(
@@ -90,11 +92,13 @@ export async function deleteIpsecUser(
const q = new URLSearchParams()
if (opts?.removeCertificate === false) q.set("removeCertificate", "false")
const suffix = q.size > 0 ? `?${q.toString()}` : ""
return requestJson<{ ok: boolean }>(
const result = await requestJson<{ ok: boolean }>(
baseUrl,
`/api/ipsec/users/${encodeURIComponent(serverId)}/${encodeURIComponent(clientId)}${suffix}`,
{ method: "DELETE" },
)
if (result?.ok !== true) throw new Error("Сервер не подтвердил удаление")
return result
}
function parseExportBundle(response: unknown): IpsecCertBundle {
@@ -169,11 +173,13 @@ export async function deleteIpsecPeer(
const q = new URLSearchParams()
if (opts?.force) q.set("force", "true")
const suffix = q.size > 0 ? `?${q.toString()}` : ""
return requestJson<{ ok: boolean }>(
const result = await requestJson<{ ok: boolean }>(
baseUrl,
`/api/ipsec/peers/${encodeURIComponent(serverId)}/${encodeURIComponent(peerId)}${suffix}`,
{ method: "DELETE" },
)
if (result?.ok !== true) throw new Error("Сервер не подтвердил удаление")
return result
}
export async function deleteIpsecCert(
@@ -185,9 +191,11 @@ export async function deleteIpsecCert(
const q = new URLSearchParams()
if (opts?.force) q.set("force", "true")
const suffix = q.size > 0 ? `?${q.toString()}` : ""
return requestJson<{ ok: boolean }>(
const result = await requestJson<{ ok: boolean }>(
baseUrl,
`/api/ipsec/certs/${encodeURIComponent(serverId)}${suffix}`,
{ method: "DELETE", body: JSON.stringify({ name }) },
)
if (result?.ok !== true) throw new Error("Сервер не подтвердил удаление")
return result
}