Browse Source

修复退出登录一直轮询问题

li.shaoyi 3 years ago
parent
commit
5b750fdcc1
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/services/socket/quota/index.ts

+ 7 - 2
src/services/socket/quota/index.ts

@@ -5,6 +5,7 @@ import Bus from '@/utils/eventBus/index';
 import timerUtil from '@/utils/timer/timerUtil';
 import { Callback } from '@/utils/websocket/index';
 import { SubscribeInfoType } from './interface';
+import { isLogin } from '@/services/bus/login';
 
 
 const subscribeGoodsList = new Map<string, SubscribeInfoType[]>(); // 订阅商品数据中心池
@@ -70,8 +71,12 @@ function actionSubcribe() {
                     });
             },
             onFail: (err) => {
-                isSubscribeSucess = false
-                console.log('订阅失败:', err)
+                if (isLogin()) {
+                    isSubscribeSucess = false
+                    console.log('订阅失败:', err)
+                } else {
+                    isSubscribeSucess = true
+                }
             },
         } as Callback);
     }