fix(ui): завершить локальную приёмку трафика и статистики
This commit is contained in:
1 parent
48b7a061c1
commit
165f40acd7
10 files changed
+130
-28
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { statisticsDtoSchema, statisticsPivotDtoSchema } from "@mmapp/contracts/statistics"
|
||||
import type {
|
||||
StatisticsDto,
|
||||
StatisticsPivotDto,
|
||||
@@ -23,7 +24,9 @@ export async function getStatistics(
|
||||
if (query.service) params.set("service", query.service)
|
||||
if (query.asn != null) params.set("asn", String(query.asn))
|
||||
if (query.planes && query.planes !== "unique") params.set("planes", query.planes)
|
||||
return requestJson<StatisticsDto>(baseUrl, `/api/statistics?${params.toString()}`)
|
||||
const parsed = statisticsDtoSchema.safeParse(await requestJson<unknown>(baseUrl, `/api/statistics?${params.toString()}`))
|
||||
if (!parsed.success) throw new Error("Некорректный ответ статистики")
|
||||
return parsed.data
|
||||
}
|
||||
|
||||
export async function getStatisticsPivot(
|
||||
@@ -43,5 +46,7 @@ export async function getStatisticsPivot(
|
||||
if (query.service) params.set("service", query.service)
|
||||
if (query.asn != null) params.set("asn", String(query.asn))
|
||||
if (query.planes && query.planes !== "unique") params.set("planes", query.planes)
|
||||
return requestJson<StatisticsPivotDto>(baseUrl, `/api/statistics/pivot?${params.toString()}`)
|
||||
const parsed = statisticsPivotDtoSchema.safeParse(await requestJson<unknown>(baseUrl, `/api/statistics/pivot?${params.toString()}`))
|
||||
if (!parsed.success) throw new Error("Некорректный ответ сводной статистики")
|
||||
return parsed.data
|
||||
}
|
||||
Reference in new issue
Block a user