标题的问题的解决方法:

// 创建第三方接口专用实例
const thirdPartyRequest = axios.create({
  baseURL: 'https://api.third-party.com',
  timeout: 10000
});

// 使用专用实例调用接口
export function callThirdPartyAPI(data) {
  return thirdPartyRequest({
    url: '/endpoint',
    method: 'post',
    data: data,
    headers: {
      'Authorization': 'Bearer your-fixed-token-here'
    }
  });
}
 

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐