axios拦截器
This commit is contained in:
parent
27a654c246
commit
2652b2d608
@ -10,7 +10,7 @@ const service = axios.create({
|
|||||||
timeout: 5000 // request timeout
|
timeout: 5000 // request timeout
|
||||||
})
|
})
|
||||||
|
|
||||||
// request interceptor
|
// request interceptor // axios的请求拦截器
|
||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
// do something before request is sent
|
// do something before request is sent
|
||||||
@ -82,6 +82,7 @@ service.interceptors.request.use(
|
|||||||
// }
|
// }
|
||||||
// )
|
// )
|
||||||
|
|
||||||
|
// 响应拦截器
|
||||||
service.interceptors.response.use(res => {
|
service.interceptors.response.use(res => {
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user