From 20b4f47f63ce15f9dc4992d115c97b8bb342a756 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Tue, 3 Dec 2024 14:37:50 +0800 Subject: [PATCH] fix: remove planDataMod --- src/components/ServiceTracker.tsx | 3 ++- src/lib/utils.ts | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/components/ServiceTracker.tsx b/src/components/ServiceTracker.tsx index 3dbc446..6833ec0 100644 --- a/src/components/ServiceTracker.tsx +++ b/src/components/ServiceTracker.tsx @@ -4,6 +4,7 @@ import { useQuery } from "@tanstack/react-query"; import { fetchService } from "@/lib/nezha-api"; import { ServiceData } from "@/types/nezha-api"; import { CycleTransferStatsCard } from "./CycleTransferStats"; +import { Loader } from "./loading/Loader"; export const ServiceTracker: React.FC = () => { const { data: serviceData, isLoading } = useQuery({ @@ -36,7 +37,7 @@ export const ServiceTracker: React.FC = () => { }; if (isLoading) { - return
Loading...
; + return
Loading...
; } if ( diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 2089ecc..584b424 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -135,7 +135,7 @@ interface PlanData { interface PublicNoteData { billingDataMod: BillingData; - planDataMod: PlanData; + // planDataMod: PlanData; } export function parsePublicNote(publicNote: string): PublicNoteData | null { @@ -146,21 +146,21 @@ export function parsePublicNote(publicNote: string): PublicNoteData | null { const data = JSON.parse(publicNote); return { billingDataMod: { - startDate: data.billingDataMod.startDate, + startDate: data.billingDataMod.startDate || "", endDate: data.billingDataMod.endDate, - autoRenewal: data.billingDataMod.autoRenewal, - cycle: data.billingDataMod.cycle, - amount: data.billingDataMod.amount, - }, - planDataMod: { - bandwidth: data.planDataMod.bandwidth, - trafficVol: data.planDataMod.trafficVol, - trafficType: data.planDataMod.trafficType, - IPv4: data.planDataMod.IPv4, - IPv6: data.planDataMod.IPv6, - networkRoute: data.planDataMod.networkRoute, - extra: data.planDataMod.extra, - }, + autoRenewal: data.billingDataMod.autoRenewal || "", + cycle: data.billingDataMod.cycle || "", + amount: data.billingDataMod.amount || "", + } + // planDataMod: { + // bandwidth: data.planDataMod.bandwidth || "", + // trafficVol: data.planDataMod.trafficVol || "", + // trafficType: data.planDataMod.trafficType || "", + // IPv4: data.planDataMod.IPv4 || "", + // IPv6: data.planDataMod.IPv6 || "", + // networkRoute: data.planDataMod.networkRoute || "", + // extra: data.planDataMod.extra || "", + // }, }; } catch (error) { console.error("Error parsing public note:", error);