From d98a42fcd8632b35f5eb1bb6d60b3685f190f251 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Wed, 27 Nov 2024 08:56:17 +0800 Subject: [PATCH] fix: country code --- src/components/ServerDetailOverview.tsx | 6 +++--- src/lib/utils.ts | 2 +- src/types/nezha-api.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/ServerDetailOverview.tsx b/src/components/ServerDetailOverview.tsx index adb0edc..fd8ceb3 100644 --- a/src/components/ServerDetailOverview.tsx +++ b/src/components/ServerDetailOverview.tsx @@ -134,13 +134,13 @@ export default function ServerDetailOverview() {

- {server.host.country_code?.toUpperCase() || + {server.country_code?.toUpperCase() || t("serverDetail.unknown")}
- {server.host.country_code && ( + {server.country_code && ( )}
diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 12c9db3..ab11cfc 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -23,7 +23,7 @@ export function formatNezhaInfo(serverInfo: NezhaAPI) { swap: (serverInfo.state.swap_used / serverInfo.host.swap_total) * 100 || 0, disk: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0, stg: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0, - country_code: serverInfo.host.country_code, + country_code: serverInfo.country_code, }; } diff --git a/src/types/nezha-api.ts b/src/types/nezha-api.ts index 3bbc591..9699bbc 100644 --- a/src/types/nezha-api.ts +++ b/src/types/nezha-api.ts @@ -7,6 +7,7 @@ export interface NezhaAPI { id: number; name: string; last_active: string; + country_code: string; host: NezhaAPIHost; state: NezhaAPIStatus; }