@ventlio/tanstack-query 0.2.81 → 0.2.82
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
|
@@ -715,8 +715,9 @@ const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelect
|
|
|
715
715
|
};
|
|
716
716
|
// register post mutation
|
|
717
717
|
const mutation = useMutation(async (postData) => new Promise((res, rej) => sendRequest(res, rej, postData)));
|
|
718
|
-
const post = async (data, options
|
|
719
|
-
|
|
718
|
+
const post = async (data, options) => {
|
|
719
|
+
const { requestConfig, ...otherOptions } = options ?? {};
|
|
720
|
+
return mutation.mutateAsync({ data, requestConfig }, otherOptions);
|
|
720
721
|
};
|
|
721
722
|
return { post, uploadProgressPercent, ...mutation };
|
|
722
723
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -30,10 +30,16 @@ export declare const usePostRequest: <TResponse>({ path, isFormData, baseUrl, he
|
|
|
30
30
|
data: any;
|
|
31
31
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
32
32
|
}, unknown>;
|
|
33
|
-
post: <T>(data?: T | undefined, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
33
|
+
post: <T>(data?: T | undefined, options?: (MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
34
34
|
data: T;
|
|
35
35
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
36
|
-
}, unknown>
|
|
36
|
+
}, unknown> & {
|
|
37
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
38
|
+
}) | ({
|
|
39
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
40
|
+
} & {
|
|
41
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
42
|
+
}) | undefined) => Promise<IRequestSuccess<TResponse>>;
|
|
37
43
|
uploadProgressPercent: number;
|
|
38
44
|
} | {
|
|
39
45
|
data: undefined;
|
|
@@ -60,10 +66,16 @@ export declare const usePostRequest: <TResponse>({ path, isFormData, baseUrl, he
|
|
|
60
66
|
data: any;
|
|
61
67
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
62
68
|
}, unknown>;
|
|
63
|
-
post: <T>(data?: T | undefined, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
69
|
+
post: <T>(data?: T | undefined, options?: (MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
64
70
|
data: T;
|
|
65
71
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
66
|
-
}, unknown>
|
|
72
|
+
}, unknown> & {
|
|
73
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
74
|
+
}) | ({
|
|
75
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
76
|
+
} & {
|
|
77
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
78
|
+
}) | undefined) => Promise<IRequestSuccess<TResponse>>;
|
|
67
79
|
uploadProgressPercent: number;
|
|
68
80
|
} | {
|
|
69
81
|
data: undefined;
|
|
@@ -90,10 +102,16 @@ export declare const usePostRequest: <TResponse>({ path, isFormData, baseUrl, he
|
|
|
90
102
|
data: any;
|
|
91
103
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
92
104
|
}, unknown>;
|
|
93
|
-
post: <T>(data?: T | undefined, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
105
|
+
post: <T>(data?: T | undefined, options?: (MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
94
106
|
data: T;
|
|
95
107
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
96
|
-
}, unknown>
|
|
108
|
+
}, unknown> & {
|
|
109
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
110
|
+
}) | ({
|
|
111
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
112
|
+
} & {
|
|
113
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
114
|
+
}) | undefined) => Promise<IRequestSuccess<TResponse>>;
|
|
97
115
|
uploadProgressPercent: number;
|
|
98
116
|
} | {
|
|
99
117
|
data: IRequestSuccess<TResponse>;
|
|
@@ -120,9 +138,15 @@ export declare const usePostRequest: <TResponse>({ path, isFormData, baseUrl, he
|
|
|
120
138
|
data: any;
|
|
121
139
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
122
140
|
}, unknown>;
|
|
123
|
-
post: <T>(data?: T | undefined, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
141
|
+
post: <T>(data?: T | undefined, options?: (MutateOptions<IRequestSuccess<TResponse>, IRequestError, {
|
|
124
142
|
data: T;
|
|
125
143
|
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
126
|
-
}, unknown>
|
|
144
|
+
}, unknown> & {
|
|
145
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
146
|
+
}) | ({
|
|
147
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
148
|
+
} & {
|
|
149
|
+
requestConfig?: Partial<Omit<IMakeRequest, "body">> | undefined;
|
|
150
|
+
}) | undefined) => Promise<IRequestSuccess<TResponse>>;
|
|
127
151
|
uploadProgressPercent: number;
|
|
128
152
|
};
|
|
@@ -53,8 +53,9 @@ const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelect
|
|
|
53
53
|
};
|
|
54
54
|
// register post mutation
|
|
55
55
|
const mutation = useMutation(async (postData) => new Promise((res, rej) => sendRequest(res, rej, postData)));
|
|
56
|
-
const post = async (data, options
|
|
57
|
-
|
|
56
|
+
const post = async (data, options) => {
|
|
57
|
+
const { requestConfig, ...otherOptions } = options ?? {};
|
|
58
|
+
return mutation.mutateAsync({ data, requestConfig }, otherOptions);
|
|
58
59
|
};
|
|
59
60
|
return { post, uploadProgressPercent, ...mutation };
|
|
60
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePostRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePostRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -80,17 +80,19 @@ export const usePostRequest = <TResponse>({
|
|
|
80
80
|
|
|
81
81
|
const post = async <T>(
|
|
82
82
|
data?: T,
|
|
83
|
-
options?:
|
|
83
|
+
options?: (
|
|
84
84
|
| MutateOptions<
|
|
85
85
|
IRequestSuccess<TResponse>,
|
|
86
86
|
IRequestError,
|
|
87
87
|
{ data: T; requestConfig?: Partial<Omit<IMakeRequest, 'body'>> },
|
|
88
88
|
unknown
|
|
89
89
|
>
|
|
90
|
-
|
|
|
91
|
-
|
|
90
|
+
| { requestConfig?: Partial<Omit<IMakeRequest, 'body'>> }
|
|
91
|
+
| undefined
|
|
92
|
+
) & { requestConfig?: Partial<Omit<IMakeRequest, 'body'>> }
|
|
92
93
|
): Promise<IRequestSuccess<TResponse>> => {
|
|
93
|
-
|
|
94
|
+
const { requestConfig, ...otherOptions } = options ?? {};
|
|
95
|
+
return mutation.mutateAsync({ data, requestConfig }, otherOptions);
|
|
94
96
|
};
|
|
95
97
|
|
|
96
98
|
return { post, uploadProgressPercent, ...mutation };
|