Browse Source

no message

linwenxin 1 month ago
parent
commit
6cfa4d285e
2 changed files with 3 additions and 8 deletions
  1. 2 8
      src/common/http/index.js
  2. 1 0
      src/common/utils/util.js

+ 2 - 8
src/common/http/index.js

@@ -92,10 +92,7 @@ export const $http = (url, method, data, json, loadingBool = false, isExecute =
         return Promise.reject(new Error(res.message || 'Error'))
       }
       if (res.code === 4444) {
-        // #ifdef H5
-        uni.removeStorageSync(`APPID${getQueryVariable('appid')}_token`)
-        // #endif
-        removeQueryParams(['x-token'])
+        webLogin(true)
         return {}
       }
       if (res.code === 1001) {
@@ -306,10 +303,7 @@ export const axios = function (obj = {}) {
           }
 
           if (res.code === 4444) {
-            // #ifdef H5
-            uni.removeStorageSync(`APPID${getQueryVariable('appid')}_token`)
-            // #endif
-            removeQueryParams(['x-token'])
+            webLogin(true)
             reject(new Error(res.message || 'Error'))
             return {}
           }

+ 1 - 0
src/common/utils/util.js

@@ -218,6 +218,7 @@ export function webLogin(bool = false) {
       if (code) {
         url = removeUrlParams('code')
         url = removeUrlParams('state')
+        url = removeUrlParams('x-token')
       }
       // 是否强制授权
       if (isAuthorization && (!isAuthorizationTime || isAuthorizationTime < new Date().getTime())) {