@ventlio/tanstack-query 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -352,7 +352,7 @@ async function makeRequest({ body = {}, method = HttpMethod.GET, path, isFormDat
|
|
|
352
352
|
method,
|
|
353
353
|
onUploadProgress,
|
|
354
354
|
};
|
|
355
|
-
if (Object.keys(body).length > 0) {
|
|
355
|
+
if (Object.keys(body).length > 0 || (isFormData && !isApp && [...body.keys()].length > 0)) {
|
|
356
356
|
axiosRequestConfig.data = body;
|
|
357
357
|
}
|
|
358
358
|
// send request
|
|
@@ -10,7 +10,7 @@ export interface IPagination {
|
|
|
10
10
|
total: number;
|
|
11
11
|
}
|
|
12
12
|
export type TanstackQueryOption<TResponse> = UseQueryOptions<IRequestSuccess<TResponse | undefined>, IRequestError, IRequestSuccess<TResponse | undefined>, Array<any>>;
|
|
13
|
-
export type TanstackInfiniteQueryOption<TResponse> = UseInfiniteQueryOptions<IRequestSuccess<TResponse | undefined>, IRequestError, IRequestSuccess<TResponse | undefined>, Array<any
|
|
13
|
+
export type TanstackInfiniteQueryOption<TResponse> = Partial<UseInfiniteQueryOptions<IRequestSuccess<TResponse | undefined>, IRequestError, IRequestSuccess<TResponse | undefined>, Array<any>>>;
|
|
14
14
|
export interface DefaultRequestOptions {
|
|
15
15
|
baseUrl?: string;
|
|
16
16
|
headers?: RawAxiosRequestHeaders;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InfiniteData, UseQueryOptions } from '@tanstack/react-query';
|
|
1
|
+
import type { InfiniteData, QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
|
2
2
|
import type { IRequestError, IRequestSuccess } from '../request';
|
|
3
3
|
import type { DefaultRequestOptions, TanstackInfiniteQueryOption } from './queries.interface';
|
|
4
4
|
interface Pagination {
|
|
@@ -12,9 +12,11 @@ interface Pagination {
|
|
|
12
12
|
export declare const useGetInfiniteRequest: <TResponse extends Record<string, any>>({ path, load, queryOptions, keyTracker, baseUrl, headers, }: {
|
|
13
13
|
path: string;
|
|
14
14
|
load?: boolean | undefined;
|
|
15
|
-
queryOptions?:
|
|
15
|
+
queryOptions?: Partial<import("@tanstack/react-query/build/legacy/types").UseInfiniteQueryOptions<IRequestSuccess<(TResponse & {
|
|
16
16
|
pagination: Pagination;
|
|
17
|
-
}
|
|
17
|
+
}) | undefined>, IRequestError, IRequestSuccess<(TResponse & {
|
|
18
|
+
pagination: Pagination;
|
|
19
|
+
}) | undefined>, any[], QueryKey, unknown>> | undefined;
|
|
18
20
|
keyTracker?: string | undefined;
|
|
19
21
|
} & DefaultRequestOptions) => {
|
|
20
22
|
isLoading: boolean;
|
|
@@ -19,7 +19,7 @@ async function makeRequest({ body = {}, method = HttpMethod.GET, path, isFormDat
|
|
|
19
19
|
method,
|
|
20
20
|
onUploadProgress,
|
|
21
21
|
};
|
|
22
|
-
if (Object.keys(body).length > 0) {
|
|
22
|
+
if (Object.keys(body).length > 0 || (isFormData && !isApp && [...body.keys()].length > 0)) {
|
|
23
23
|
axiosRequestConfig.data = body;
|
|
24
24
|
}
|
|
25
25
|
// send request
|
package/package.json
CHANGED
|
@@ -18,11 +18,13 @@ export type TanstackQueryOption<TResponse> = UseQueryOptions<
|
|
|
18
18
|
Array<any>
|
|
19
19
|
>;
|
|
20
20
|
|
|
21
|
-
export type TanstackInfiniteQueryOption<TResponse> =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
export type TanstackInfiniteQueryOption<TResponse> = Partial<
|
|
22
|
+
UseInfiniteQueryOptions<
|
|
23
|
+
IRequestSuccess<TResponse | undefined>,
|
|
24
|
+
IRequestError,
|
|
25
|
+
IRequestSuccess<TResponse | undefined>,
|
|
26
|
+
Array<any>
|
|
27
|
+
>
|
|
26
28
|
>;
|
|
27
29
|
|
|
28
30
|
export interface DefaultRequestOptions {
|