a1300399510@qq.com 提交于 2023/04/03 -12:00:02
This commit is contained in:
@@ -11,16 +11,19 @@ axios.defaults.withCredentials = true
|
||||
axios.defaults.emulateJSON = true
|
||||
// baseURL = "https://offer.gter.net/api"
|
||||
baseURL = "https://forum.gter.net"
|
||||
console.log("baseURL",baseURL);
|
||||
const service = axios.create({
|
||||
baseURL,
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
// service.header.authorization = "qj2q1qk1on0curclipghjtv5ja1g9eq2"
|
||||
|
||||
// 2.请求拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
//发请求前做的一些处理,数据转化,配置请求头,设置token,设置loading等,根据需求去添加
|
||||
//注意使用token的时候需要引入cookie方法或者用本地localStorage等方法,推荐js-cookie
|
||||
// console.log(config, "config");
|
||||
config['headers']['authorization'] = "qj2q1qk1on0curclipghjtv5ja1g9eq2"
|
||||
return config
|
||||
}, error => {
|
||||
Promise.reject(error)
|
||||
|
||||
Reference in New Issue
Block a user