no message
This commit is contained in:
@@ -10,7 +10,7 @@ axios.defaults.withCredentials = true
|
||||
axios.interceptors.request.use( //响应拦截
|
||||
async config => {
|
||||
// 开发时登录用的,可以直接替换小程序的 authorization
|
||||
config['headers']['authorization'] = "pa5o1v493ed5mahrcio66267e2"
|
||||
// config['headers']['authorization'] = "pa5o1v493ed5mahrcio66267e2"
|
||||
return config;
|
||||
},
|
||||
error => {
|
||||
@@ -40,13 +40,7 @@ axios.interceptors.response.use(response => {
|
||||
*/
|
||||
const get = (url, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(url, {
|
||||
params,
|
||||
}).then(res => {
|
||||
resolve(res.data);
|
||||
}).catch(err => {
|
||||
reject(err.data)
|
||||
})
|
||||
axios.get(url, { params }).then(res => resolve(res.data)).catch(err => reject(err.data))
|
||||
});
|
||||
}
|
||||
/**
|
||||
@@ -58,6 +52,7 @@ const post = (url, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
//是将对象 序列化成URL的形式,以&进行拼接
|
||||
axios.post(url, QS.stringify(params)).then(res => resolve(res.data)).catch(err => {
|
||||
// console.log(err, "err");
|
||||
if (err.data.code == 401) resolve(err.data);
|
||||
else reject(err.data)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user