From 5e79a49e00de1cf824bc178ab74cf60dc5a180b7 Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Mon, 9 Dec 2024 11:48:31 +0800 Subject: [PATCH] refactor: ip api --- src/app/services/server.ts | 4 ++-- src/types/common.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/services/server.ts b/src/app/services/server.ts index 81e45a0d..d93d6677 100644 --- a/src/app/services/server.ts +++ b/src/app/services/server.ts @@ -67,11 +67,11 @@ export const serverApi = createApi({ }), getIfInChina: builder.query({ query: () => ({ - url: `https://ipapi.co/json` + url: `https://cf-props.ihacker.dev` }), transformResponse: (resp: IPData) => { if (!("error" in resp)) { - return resp.country_code.toUpperCase() == "CN"; + return resp.country.toUpperCase() == "CN"; } return false; } diff --git a/src/types/common.ts b/src/types/common.ts index b7316348..653f2539 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -15,4 +15,4 @@ export type Price = { type: PriceType; sub_dur?: PriceSubscriptionDuration; }; -export type IPData = { error?: boolean; country: string; country_code: string }; +export type IPData = { error?: boolean; country: string };