@acrool/react-fetcher 0.0.9 → 0.0.10-alpha.0

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/README.md CHANGED
@@ -131,6 +131,49 @@ logout();
131
131
 
132
132
  ---
133
133
 
134
+
135
+
136
+ ### Options queryString
137
+
138
+ (.net not support)
139
+ default: `?statusIds[]=1&statusIds[]=2`
140
+
141
+ change to: `?statusIds=1&statusIds=2`
142
+
143
+ ```ts
144
+ export const baseQueryWithAxios: BaseQueryFn<IQuery> = async (query, BaseQueryApi, extraOptions) => {
145
+ await mutex.waitForUnlock();
146
+ try {
147
+ const {url, method, fetchOptions, ...args} = query;
148
+ const data = await createRestFulFetcher(axiosInstance, {url, method}, getContentTypeWithMethod)({
149
+ ...args,
150
+ fetchOptions: {
151
+ ...fetchOptions,
152
+ paramsSerializer: (params) => {
153
+ return qs.stringify(params, {indices: false});
154
+ }
155
+ }
156
+ });
157
+
158
+ return {
159
+ data,
160
+ meta: {}
161
+ };
162
+
163
+ } catch (error: any) {
164
+ dialog.error(error.message, {code: error.code});
165
+
166
+ return {
167
+ error: {
168
+ code: error.code || 500,
169
+ message: error.message
170
+ },
171
+ };
172
+ }
173
+ };
174
+ ```
175
+
176
+
134
177
  ## License
135
178
 
136
179
  MIT © [Acrool](https://github.com/acrool) & [Imagine](https://github.com/imagine10255)
@@ -125,7 +125,7 @@ function $(t2) {
125
125
  return e2(t2), n;
126
126
  }
127
127
  const getDataWithContentType = (contentType, data = {}) => {
128
- if ([ERequestContentType.formData, ERequestContentType.formUrlDecode].includes(contentType)) return $(data);
128
+ if ([ERequestContentType.formData].includes(contentType)) return $(data);
129
129
  return JSON.stringify(data);
130
130
  };
131
131
  const createRestFulFetcher = (axiosInstance, document2, options) => {