axios请求添加token的方法

// post请求
axios.post('path', {}, {
  headers: {
    authorization: `Bearer ${token}`,
  },
});

// get请求
axios.get('path', {
  headers: {
    authorization: `Bearer ${token}`,
  },
});

// 统一方式
axios.defaults.headers['authorization'] = `Bearer ${token}`;