feima-shortcuts 1.0.2 → 1.0.4
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/package.json +1 -1
- package/src/generateApi/index.js +2 -7
package/package.json
CHANGED
package/src/generateApi/index.js
CHANGED
|
@@ -142,22 +142,17 @@ export const request = <T>(
|
|
|
142
142
|
options: ApiRequestOptions
|
|
143
143
|
): CancelablePromise<T> => {
|
|
144
144
|
return new CancelablePromise((resolve, reject, onCancel) => {
|
|
145
|
-
// Get the request URL. Depending on your needs, this might need additional processing,
|
|
146
|
-
// @see ./src/templates/core/functions/getUrl.hbs
|
|
147
145
|
const url = \`\${config.BASE}\${options.path}\`;
|
|
148
146
|
|
|
149
|
-
// Optional: Get and link the cancelation token, so the request can be aborted.
|
|
150
147
|
const source = service.CancelToken.source();
|
|
148
|
+
|
|
151
149
|
onCancel(() => source.cancel("The user aborted a request."));
|
|
152
150
|
|
|
153
|
-
// Execute the request. This is a minimal example, in real world scenarios
|
|
154
|
-
// you will need to add headers, process form data, etc.
|
|
155
|
-
// @see ./src/templates/core/axios/request.hbs
|
|
156
151
|
service
|
|
157
152
|
.request({
|
|
153
|
+
...options,
|
|
158
154
|
url,
|
|
159
155
|
data: options.body,
|
|
160
|
-
method: options.method,
|
|
161
156
|
cancelToken: source.token,
|
|
162
157
|
})
|
|
163
158
|
.then((data: any) => {
|