refactor: ip api
This commit is contained in:
@@ -67,11 +67,11 @@ export const serverApi = createApi({
|
||||
}),
|
||||
getIfInChina: builder.query<boolean, void>({
|
||||
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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user