fix(evobgp): требовать подтверждение проверки соединения
This commit is contained in:
1 parent
0d2affaf6b
commit
dd387cf379
7 files changed
+64
-3
No files matched your search
@@ -10,6 +10,7 @@ import {
|
||||
} from "react"
|
||||
import { useDataSource } from "@/lib/data-source"
|
||||
import type { Domain, IpRange, Asn } from "@/lib/data"
|
||||
import { confirmEvoBgpConnection } from "@/lib/evobgp-test-receipt"
|
||||
import { parseEvoBgpCatalog } from "@/lib/evobgp-catalog"
|
||||
import { ApiClientError, requestJson } from "@/shared/api/http-client"
|
||||
|
||||
@@ -172,10 +173,11 @@ export function EvoBGPProvider({ children }: { children: React.ReactNode }) {
|
||||
const testConnection = useCallback(
|
||||
async (draft?: EvoBgpTestDraft) => {
|
||||
try {
|
||||
await requestJson<{ ok?: boolean }>(backendUrl, "/api/evobgp/test", {
|
||||
const receipt = await requestJson<unknown>(backendUrl, "/api/evobgp/test", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(draft ?? {}),
|
||||
})
|
||||
confirmEvoBgpConnection(receipt)
|
||||
return { ok: true, message: "Соединение с EvoBGP установлено" }
|
||||
} catch (e) {
|
||||
return { ok: false, message: errorMessage(e, "Ошибка") }
|
||||
|
||||
Reference in new issue
Block a user