refactor: ip api

This commit is contained in:
Tristan Yang
2024-12-09 11:48:31 +08:00
parent f2f3dd9489
commit 5e79a49e00
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -67,11 +67,11 @@ export const serverApi = createApi({
}), }),
getIfInChina: builder.query<boolean, void>({ getIfInChina: builder.query<boolean, void>({
query: () => ({ query: () => ({
url: `https://ipapi.co/json` url: `https://cf-props.ihacker.dev`
}), }),
transformResponse: (resp: IPData) => { transformResponse: (resp: IPData) => {
if (!("error" in resp)) { if (!("error" in resp)) {
return resp.country_code.toUpperCase() == "CN"; return resp.country.toUpperCase() == "CN";
} }
return false; return false;
} }
+1 -1
View File
@@ -15,4 +15,4 @@ export type Price = {
type: PriceType; type: PriceType;
sub_dur?: PriceSubscriptionDuration; sub_dur?: PriceSubscriptionDuration;
}; };
export type IPData = { error?: boolean; country: string; country_code: string }; export type IPData = { error?: boolean; country: string };