摘要:
axios.get('/user/12345') .catch(function (error) { if (error.response) { // 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围 console.log(error.response.data); conso 阅读全文
posted @ 2023-11-22 14:15
厚礼蝎
阅读(83)
评论(0)
推荐(0)
摘要:
在请求或响应被 then 或 catch 处理前拦截它们。 // 添加请求拦截器 axios.interceptors.request.use(function (config) { // 在发送请求之前做些什么 return config; }, function (error) { // 对请求 阅读全文
posted @ 2023-11-22 14:10
厚礼蝎
阅读(32)
评论(0)
推荐(0)