cosey 0.3.16 → 0.3.17
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/config/http.d.ts +4 -0
- package/config/http.js +5 -1
- package/package.json +1 -1
- package/request/useRequest.js +3 -0
package/config/http.d.ts
CHANGED
|
@@ -58,6 +58,10 @@ export declare const defaultHttpConfig: {
|
|
|
58
58
|
* 错误提示显示时长
|
|
59
59
|
*/
|
|
60
60
|
errorDuration: number;
|
|
61
|
+
/**
|
|
62
|
+
* 是否直接返回 AxiosResponse 对象
|
|
63
|
+
*/
|
|
64
|
+
originalResponse: boolean;
|
|
61
65
|
};
|
|
62
66
|
export type HttpConfig = DeepPartial<typeof defaultHttpConfig>;
|
|
63
67
|
export type RequiredHttpConfig = typeof defaultHttpConfig;
|
package/config/http.js
CHANGED
package/package.json
CHANGED
package/request/useRequest.js
CHANGED
|
@@ -60,6 +60,9 @@ function useRequest(config = {}, useHttpConfig) {
|
|
|
60
60
|
);
|
|
61
61
|
axiosIns.interceptors.response.use(
|
|
62
62
|
(response) => {
|
|
63
|
+
if (mergedHttpConfig.originalResponse) {
|
|
64
|
+
return response;
|
|
65
|
+
}
|
|
63
66
|
const { data: resData } = response;
|
|
64
67
|
return handleError(resData, mergedHttpConfig);
|
|
65
68
|
},
|