axios拦截器

This commit is contained in:
jqtmviyu@gmail.com 2021-01-13 15:55:19 +08:00
parent 27a654c246
commit 2652b2d608

View File

@ -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
}) })