exnet-routing 1.1.5 → 1.1.7
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.
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/* eslint-disable no-console */
|
|
7
6
|
const index_1 = require("../../index");
|
|
8
7
|
const axios_1 = __importDefault(require("axios"));
|
|
9
8
|
const setup_1 = require("../setup");
|
|
@@ -179,6 +179,7 @@ describe("Ops Routes", () => {
|
|
|
179
179
|
direction: "desc",
|
|
180
180
|
},
|
|
181
181
|
});
|
|
182
|
+
expect(response.data.data[0].id).toBe(1);
|
|
182
183
|
});
|
|
183
184
|
});
|
|
184
185
|
});
|
|
@@ -219,6 +220,7 @@ describe("Ops Routes", () => {
|
|
|
219
220
|
direction: "desc",
|
|
220
221
|
},
|
|
221
222
|
});
|
|
223
|
+
expect(response.data.data[0].id).toBe(1);
|
|
222
224
|
});
|
|
223
225
|
});
|
|
224
226
|
});
|
package/dist/core/_untils.js
CHANGED
|
@@ -27,27 +27,29 @@ exports.apiFetch = {
|
|
|
27
27
|
fetch: async (urlInput, method, body, searchParams, queryParams) => {
|
|
28
28
|
try {
|
|
29
29
|
let url = (0, exports.apiUrlBuilder)(urlInput, baseUrl, host);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
// Remplacer les paramètres dynamiques dans l'URL
|
|
31
|
+
if (queryParams && typeof queryParams === 'object') {
|
|
32
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
33
|
+
if (value !== undefined && value !== null) {
|
|
34
|
+
const placeholder = `:${key}`;
|
|
35
|
+
if (url.includes(placeholder)) {
|
|
36
|
+
url = url.replace(placeholder, String(value));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.join("&");
|
|
50
|
-
url += (url.includes("?") ? "&" : "?") + searchParamsString;
|
|
41
|
+
// Ajouter les paramètres de recherche
|
|
42
|
+
const finalSearchParams = new URLSearchParams();
|
|
43
|
+
if (searchParams && typeof searchParams === 'object') {
|
|
44
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
45
|
+
if (value !== undefined && value !== null) {
|
|
46
|
+
finalSearchParams.append(key, String(value));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const searchString = finalSearchParams.toString();
|
|
50
|
+
if (searchString) {
|
|
51
|
+
url += (url.includes('?') ? '&' : '?') + searchString;
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
const res = await (0, axios_1.default)({
|
|
53
55
|
headers: {
|