接口环境设置
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user