no message

This commit is contained in:
A1300399510
2024-01-02 19:03:39 +08:00
parent d7915dd321
commit 5ad39c3e39
9 changed files with 281 additions and 52 deletions

View File

@@ -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)
})