|
@@ -41,6 +41,7 @@ export const axiosFactory = () => {
|
|
|
let axiosObj = axiosConfig[key] as any[]
|
|
|
const apis: any = {
|
|
|
set (val: AxiosConfig[K]) {
|
|
|
+ console.error('set', key, val)
|
|
|
axiosObj = axiosConfig[key] = val as any
|
|
|
}
|
|
|
}
|
|
@@ -131,20 +132,22 @@ export const axiosFactory = () => {
|
|
|
hook.before && hook.before(config)
|
|
|
}
|
|
|
|
|
|
- // if (!matchURL(axiosConfig.unTokenSet, config)) {
|
|
|
- // if (!axiosConfig.token) {
|
|
|
- // if (!offline && !matchURL(axiosConfig.unReqErrorSet, config)) {
|
|
|
- // const error = new Error('缺少token')
|
|
|
- // callErrorHandler('req', error, config)
|
|
|
- // throw error
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // config.headers = {
|
|
|
- // ...config.headers,
|
|
|
- // token: axiosConfig.token
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
+ console.log(axiosConfig.unTokenSet)
|
|
|
+ if (!matchURL(axiosConfig.unTokenSet, config)) {
|
|
|
+ if (!axiosConfig.token) {
|
|
|
+ if (!offline && !matchURL(axiosConfig.unReqErrorSet, config)) {
|
|
|
+ console.log(config)
|
|
|
+ const error = new Error('缺少token')
|
|
|
+ callErrorHandler('req', error, config)
|
|
|
+ throw error
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ config.headers = {
|
|
|
+ ...config.headers,
|
|
|
+ token: axiosConfig.token
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return config
|
|
|
}
|
|
|
)
|