fix(ui): подтверждать инициализацию IPsec и сохранять форму
This commit is contained in:
1 parent
4a8d696e4e
commit
f9413d5100
7 files changed
+144
-27
No files matched your search
+7
-1
@@ -1,3 +1,4 @@
|
||||
import { ipsecServerSummaryDtoSchema } from "@mmapp/contracts/ipsec"
|
||||
import { requestJson } from "@/shared/api/http-client"
|
||||
import type {
|
||||
IpsecCertBundle,
|
||||
@@ -24,10 +25,15 @@ export async function initIpsecServer(
|
||||
baseUrl: string,
|
||||
body: IpsecInitRequest,
|
||||
): Promise<IpsecServerSummaryDto> {
|
||||
return requestJson<IpsecServerSummaryDto>(baseUrl, "/api/ipsec/server/init", {
|
||||
const response = await requestJson<unknown>(baseUrl, "/api/ipsec/server/init", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
const result = ipsecServerSummaryDtoSchema.safeParse(response)
|
||||
if (!result.success || result.data.serverId !== body.serverId || !result.data.initialized) {
|
||||
throw new Error("Сервер не подтвердил инициализацию IKEv2")
|
||||
}
|
||||
return result.data
|
||||
}
|
||||
|
||||
export async function deleteIpsecServer(
|
||||
|
||||
Reference in new issue
Block a user