接口环境设置

This commit is contained in:
仲么了
2023-03-16 15:26:25 +08:00
parent 7e9cfadb23
commit c5ed54924b
20 changed files with 6480 additions and 37 deletions

View File

@@ -30,16 +30,12 @@ export default (options = {}) => {
},
method: options.method || 'GET',
success: async (res) => {
console.warn(res);
if (options.url.indexOf('/org/login/valid') > -1) {
uni.setStorageSync('Cookie', res.header['Set-Cookie']);
}
if (arr.indexOf(options.url) > -1) {
arr.splice(arr.indexOf(options.url), 1)
}
if (res.data.isOk === false) {
reject(res.data)
if (res.data.resultCode !== 10000) {
errHandler(res.data)
reject(res.data)
} else {
reslove(res.data)
}
@@ -66,7 +62,7 @@ export default (options = {}) => {
* @param {Number} code 错误码
*/
function errHandler (res) {
switch (res.code) {
switch (res.resultCode) {
case '401':
// #ifdef MP
uni.removeStorageSync('Cookie');