Skip to content

Commit 17a480b

Browse files
committed
Adjust isSuccess and pass to axios
1 parent 82f1083 commit 17a480b

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"types/index.d.ts"
4343
],
4444
"scripts": {
45-
"clean": "rimraf ./dist ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
45+
"clean": "npx rimraf ./dist ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
4646
"build": "rollup --config --environment NODE_ENV:development",
4747
"build:watch": "rollup --config --environment NODE_ENV:development --watch",
4848
"release": "rollup --config --environment NODE_ENV:production",

src/templates/core/axios/sendRequest.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const sendRequest = async <T>(
1818
withCredentials: config.WITH_CREDENTIALS,
1919
withXSRFToken: config.CREDENTIALS === 'include' ? config.WITH_CREDENTIALS : false,
2020
cancelToken: source.token,
21+
validateStatus: isSuccess,
2122
};
2223

2324
onCancel(() => source.cancel('The user aborted a request.'));
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const isSuccess = (status: number): boolean => {
2-
return status >= 200 && status < 300;
2+
return (status >= 200 && status < 300) || status === 304;
33
};

0 commit comments

Comments
 (0)