Refactor API hooks to remove infinite query support and update API client base URL
- Removed infinite query options and related functions from Trading212, User Registration, and User API files. - Updated API client base URLs in privateClient.ts and publicClient.ts to use environment variable for backend URL. - Refactored Downloader component to directly call API functions for video info retrieval instead of using a hook.
This commit is contained in:
@@ -3,20 +3,16 @@
|
||||
* Do not edit manually.
|
||||
* OpenAPI spec version: 0.0.0
|
||||
*/
|
||||
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import type {
|
||||
DataTag,
|
||||
DefinedInitialDataOptions,
|
||||
DefinedUseInfiniteQueryResult,
|
||||
DefinedUseQueryResult,
|
||||
InfiniteData,
|
||||
MutationFunction,
|
||||
QueryClient,
|
||||
QueryFunction,
|
||||
QueryKey,
|
||||
UndefinedInitialDataOptions,
|
||||
UseInfiniteQueryOptions,
|
||||
UseInfiniteQueryResult,
|
||||
UseMutationOptions,
|
||||
UseMutationResult,
|
||||
UseQueryOptions,
|
||||
@@ -126,13 +122,6 @@ export const apiAccountVerifyEmailRetrieve = (
|
||||
});
|
||||
};
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveInfiniteQueryKey = (
|
||||
uidb64?: string,
|
||||
token?: string,
|
||||
) => {
|
||||
return ["infinite", `/api/account/verify-email/${uidb64}/${token}/`] as const;
|
||||
};
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveQueryKey = (
|
||||
uidb64?: string,
|
||||
token?: string,
|
||||
@@ -140,173 +129,6 @@ export const getApiAccountVerifyEmailRetrieveQueryKey = (
|
||||
return [`/api/account/verify-email/${uidb64}/${token}/`] as const;
|
||||
};
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveInfiniteQueryOptions = <
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getApiAccountVerifyEmailRetrieveInfiniteQueryKey(uidb64, token);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
> = ({ signal }) => apiAccountVerifyEmailRetrieve(uidb64, token, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!(uidb64 && token),
|
||||
...queryOptions,
|
||||
} as UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
|
||||
export type ApiAccountVerifyEmailRetrieveInfiniteQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>;
|
||||
export type ApiAccountVerifyEmailRetrieveInfiniteQueryError = void;
|
||||
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
> &
|
||||
Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
/**
|
||||
* @summary Verify user email via link
|
||||
*/
|
||||
|
||||
export function useApiAccountVerifyEmailRetrieveInfinite<
|
||||
TData = InfiniteData<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>
|
||||
>,
|
||||
TError = void,
|
||||
>(
|
||||
uidb64: string,
|
||||
token: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseInfiniteQueryOptions<
|
||||
Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError,
|
||||
TData
|
||||
>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getApiAccountVerifyEmailRetrieveInfiniteQueryOptions(
|
||||
uidb64,
|
||||
token,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useInfiniteQuery(
|
||||
queryOptions,
|
||||
queryClient,
|
||||
) as UseInfiniteQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
export const getApiAccountVerifyEmailRetrieveQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof apiAccountVerifyEmailRetrieve>>,
|
||||
TError = void,
|
||||
|
||||
Reference in New Issue
Block a user