|
|
|
@ -13,10 +13,11 @@ const service = axios.create({ |
|
|
|
// request拦截器,在请求之前做一些处理
|
|
|
|
service.interceptors.request.use( |
|
|
|
config => { |
|
|
|
// if (store.state.token) {
|
|
|
|
// // 给请求头添加user-token
|
|
|
|
// config.headers["user-token"] = store.state.token;
|
|
|
|
// }
|
|
|
|
const token = uni.getStorageSync('token'); |
|
|
|
if (token) { |
|
|
|
// 给请求头添加user-token
|
|
|
|
config.headers["CreatorAuthorization"] = token; |
|
|
|
} |
|
|
|
config.headers['Content-Type'] = 'application/json' |
|
|
|
// config.method === 'post' ?
|
|
|
|
// config.data = qs.stringify({ ...config.data
|
|
|
|
|