@ventlio/tanstack-query 0.2.63-beta.1 → 0.2.63-beta.3
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
|
@@ -201,7 +201,7 @@ const successTransformer = (data) => {
|
|
|
201
201
|
|
|
202
202
|
async function makeRequest({ body, method = HttpMethod.GET, path, isFormData, headers = {}, baseURL, timeout, }) {
|
|
203
203
|
// configure body
|
|
204
|
-
body = isFormData ?
|
|
204
|
+
body = isFormData ? axios.toFormData(body) : body;
|
|
205
205
|
// configure request header
|
|
206
206
|
if (!isFormData) {
|
|
207
207
|
headers['Content-Type'] = ContentType.APPLICATION_JSON;
|
|
@@ -277,7 +277,7 @@ const useDeleteRequest = (deleteOptions) => {
|
|
|
277
277
|
internalDeleteOptions = internalDeleteOptions ?? {};
|
|
278
278
|
internalDeleteOptions.enabled = true;
|
|
279
279
|
await updatedPathAsync(link);
|
|
280
|
-
await setOptionsAsync(
|
|
280
|
+
await setOptionsAsync(internalDeleteOptions);
|
|
281
281
|
return query.data;
|
|
282
282
|
};
|
|
283
283
|
return { destroy, ...query };
|
|
@@ -41,7 +41,7 @@ const useDeleteRequest = (deleteOptions) => {
|
|
|
41
41
|
internalDeleteOptions = internalDeleteOptions ?? {};
|
|
42
42
|
internalDeleteOptions.enabled = true;
|
|
43
43
|
await updatedPathAsync(link);
|
|
44
|
-
await setOptionsAsync(
|
|
44
|
+
await setOptionsAsync(internalDeleteOptions);
|
|
45
45
|
return query.data;
|
|
46
46
|
};
|
|
47
47
|
return { destroy, ...query };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import { axiosInstance } from './axios-instance.js';
|
|
2
|
-
import { buildFormData } from './buildFormData.js';
|
|
3
3
|
import { ContentType, HttpMethod } from './request.enum.js';
|
|
4
4
|
import { errorTransformer, successTransformer } from './transformer.js';
|
|
5
5
|
|
|
6
6
|
async function makeRequest({ body, method = HttpMethod.GET, path, isFormData, headers = {}, baseURL, timeout, }) {
|
|
7
7
|
// configure body
|
|
8
|
-
body = isFormData ?
|
|
8
|
+
body = isFormData ? axios.toFormData(body) : body;
|
|
9
9
|
// configure request header
|
|
10
10
|
if (!isFormData) {
|
|
11
11
|
headers['Content-Type'] = ContentType.APPLICATION_JSON;
|
package/package.json
CHANGED
|
@@ -63,7 +63,7 @@ export const useDeleteRequest = <TResponse>(deleteOptions?: DefaultRequestOption
|
|
|
63
63
|
internalDeleteOptions.enabled = true;
|
|
64
64
|
|
|
65
65
|
await updatedPathAsync(link);
|
|
66
|
-
await setOptionsAsync(
|
|
66
|
+
await setOptionsAsync(internalDeleteOptions);
|
|
67
67
|
|
|
68
68
|
return query.data;
|
|
69
69
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import { axiosInstance } from './axios-instance';
|
|
2
3
|
|
|
3
|
-
import { buildFormData } from './buildFormData';
|
|
4
4
|
import { ContentType, HttpMethod } from './request.enum';
|
|
5
5
|
import type { IMakeRequest } from './request.interface';
|
|
6
6
|
import { errorTransformer, successTransformer } from './transformer';
|
|
@@ -15,7 +15,7 @@ export async function makeRequest<TResponse>({
|
|
|
15
15
|
timeout,
|
|
16
16
|
}: IMakeRequest) {
|
|
17
17
|
// configure body
|
|
18
|
-
body = isFormData ?
|
|
18
|
+
body = isFormData ? axios.toFormData(body as Record<string, any>) : body;
|
|
19
19
|
|
|
20
20
|
// configure request header
|
|
21
21
|
if (!isFormData) {
|