-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
command
yarn react-query-swagger /tanstack /post-queries-start-with-get /input:./swagger.json /output:src/api/axios-client.ts /template:Axios /minimal /serviceHost:. /use-recommended-configuration
version
react-query-swagger": "^15.12.6"
code
// use
const userTasks = useGetAccountCardDetailsQuery({ body: userTasksBody }, {});
// types
export type GetAccountCardDetailsQueryParameters = {
body?: Types.SearchCardDetailsRequest | undefined ;
}
// generated query
export function useGetAccountCardDetailsQuery<TSelectData = Types.AccountCardDetailsDto[], TError = unknown>(...params: any []): UseQueryResult<TSelectData, TError> {
let options: UseQueryOptions<Types.AccountCardDetailsDto[], TError, TSelectData> | undefined = undefined;
let axiosConfig: AxiosRequestConfig |undefined = undefined;
let body: any = undefined;
if (params.length > 0) {
if (isParameterObject(params[0])) {
// ERROR body is undefined
({ body, } = params[0] as GetAccountCardDetailsQueryParameters);
// FIX (body = params[0] as GetAccountCardDetailsQueryParameters);
options = params[1];
axiosConfig = params[2];
} else {
[body, options, axiosConfig] = params;
}
}
const metaContext = useContext(QueryMetaContext);
options = addMetaToOptions(options, metaContext);
return useQuery<Types.AccountCardDetailsDto[], TError, TSelectData>({
queryFn: axiosConfig ? (context) => __getAccountCardDetails(context, axiosConfig) : __getAccountCardDetails,
queryKey: getAccountCardDetailsQueryKey(body), // ERROR body is undefined
...getAccountCardDetailsDefaultOptions as unknown as Omit<UseQueryOptions<Types.AccountCardDetailsDto[], TError, TSelectData>, 'queryKey'>,
...options,
});
}```Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels