exnet-routing 1.1.8 → 1.1.9
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/core/_untils.js +15 -2
- package/package.json +1 -1
package/dist/core/_untils.js
CHANGED
|
@@ -83,9 +83,22 @@ const createRouteFunction = (route, apiFetch) => {
|
|
|
83
83
|
const createFetchFunction = (paramTypes) => {
|
|
84
84
|
return async (...args) => {
|
|
85
85
|
const params = paramTypes.reduce((acc, type, index) => {
|
|
86
|
-
|
|
86
|
+
if (args[index] && typeof args[index] === 'object') {
|
|
87
|
+
if ('queryParams' in args[index]) {
|
|
88
|
+
acc.queryParams = args[index].queryParams;
|
|
89
|
+
}
|
|
90
|
+
if ('searchParams' in args[index]) {
|
|
91
|
+
acc.searchParams = args[index].searchParams;
|
|
92
|
+
}
|
|
93
|
+
if ('body' in args[index]) {
|
|
94
|
+
acc.body = args[index].body;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
acc[type] = args[index] || null;
|
|
99
|
+
}
|
|
87
100
|
return acc;
|
|
88
|
-
}, {});
|
|
101
|
+
}, { body: null, searchParams: null, queryParams: null });
|
|
89
102
|
return await apiFetch.fetch(route.url, route.method, params.body, params.searchParams, params.queryParams);
|
|
90
103
|
};
|
|
91
104
|
};
|