记得开心=。=|

封装axios

// 封装axios
import axios from "axios";

const http = axios.create({
  baseURL: "http://localhost:3006/api",
  timeout: 5000
})

// 请求拦截
http.interceptors.request.use((config)=> {
  console.log(config);
  return config;
})

// 响应拦截
http.interceptors.response.use((msg)=> {
  console.log(msg)
  return msg
}, (error)=> {
  console.log( error)
})

export default http

本文作者:HuangBingQuan

本文链接:https://www.cnblogs.com/bingquan1/p/16610704.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   HuangBingQuan  阅读(45)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 不将就 码农权
  2. 2 Bleeding Love 码农权
  3. 3 想你念你 码农权
Bleeding Love - 码农权
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.

Not available