@ventlio/tanstack-query 0.1.6 → 0.1.8
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
|
@@ -83,7 +83,7 @@ async function makeRequest({ body, method = HttpMethod.GET, path, bearerToken, i
|
|
|
83
83
|
data: body,
|
|
84
84
|
});
|
|
85
85
|
// get response json
|
|
86
|
-
const jsonResp = await resp.data
|
|
86
|
+
const jsonResp = await resp.data;
|
|
87
87
|
// get response code
|
|
88
88
|
const responseCode = resp.status;
|
|
89
89
|
if (responseCode > 299) {
|
|
@@ -91,7 +91,7 @@ async function makeRequest({ body, method = HttpMethod.GET, path, bearerToken, i
|
|
|
91
91
|
return errorTransformer({ ...jsonResp, statusCode: responseCode });
|
|
92
92
|
}
|
|
93
93
|
return successTransformer({
|
|
94
|
-
|
|
94
|
+
data: jsonResp,
|
|
95
95
|
statusCode: responseCode,
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -24,7 +24,7 @@ async function makeRequest({ body, method = request_enum.HttpMethod.GET, path, b
|
|
|
24
24
|
data: body,
|
|
25
25
|
});
|
|
26
26
|
// get response json
|
|
27
|
-
const jsonResp = await resp.data
|
|
27
|
+
const jsonResp = await resp.data;
|
|
28
28
|
// get response code
|
|
29
29
|
const responseCode = resp.status;
|
|
30
30
|
if (responseCode > 299) {
|
|
@@ -32,7 +32,7 @@ async function makeRequest({ body, method = request_enum.HttpMethod.GET, path, b
|
|
|
32
32
|
return transformer.errorTransformer({ ...jsonResp, statusCode: responseCode });
|
|
33
33
|
}
|
|
34
34
|
return transformer.successTransformer({
|
|
35
|
-
|
|
35
|
+
data: jsonResp,
|
|
36
36
|
statusCode: responseCode,
|
|
37
37
|
});
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -43,16 +43,7 @@ export const useGetRequest = <TResponse extends Record<string, any>>({
|
|
|
43
43
|
[requestPath, {}],
|
|
44
44
|
() =>
|
|
45
45
|
new Promise<IRequestSuccess<TResponse> | IRequestError>((res, rej) => {
|
|
46
|
-
|
|
47
|
-
path: requestPath,
|
|
48
|
-
bearerToken: authToken,
|
|
49
|
-
}).then((postResponse) => {
|
|
50
|
-
if (postResponse.status) {
|
|
51
|
-
res(postResponse as IRequestSuccess<TResponse>);
|
|
52
|
-
} else {
|
|
53
|
-
rej(postResponse);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
46
|
+
return sendRequest(res, rej);
|
|
56
47
|
}),
|
|
57
48
|
{
|
|
58
49
|
enabled: load,
|
|
@@ -36,7 +36,7 @@ export async function makeRequest<TResponse>({
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
// get response json
|
|
39
|
-
const jsonResp: any = await resp.data
|
|
39
|
+
const jsonResp: any = await resp.data;
|
|
40
40
|
|
|
41
41
|
// get response code
|
|
42
42
|
const responseCode = resp.status;
|
|
@@ -47,7 +47,7 @@ export async function makeRequest<TResponse>({
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return successTransformer<TResponse>({
|
|
50
|
-
|
|
50
|
+
data: jsonResp,
|
|
51
51
|
statusCode: responseCode,
|
|
52
52
|
});
|
|
53
53
|
} catch (error: any) {
|