A\An 2 лет назад
Родитель
Сommit
a2390b2f1f
1 измененных файлов с 20 добавлено и 21 удалено
  1. 20 21
      src/view/iframe/publish/give-dialog.vue

+ 20 - 21
src/view/iframe/publish/give-dialog.vue

@@ -605,11 +605,7 @@ watch(
             // 更新余额
             clearInterval(timer.value);
             timer.value = setInterval(() => {
-                getChromeStorage('userInfo', (res) => {
-                    if (res && res.accessToken) {
-                        getCurrencyInfo();
-                    }
-                });
+                getCurrencyInfo();
             }, 10000)
         } else {
             clearInterval(timer.value);
@@ -1361,22 +1357,25 @@ const getLocalCurrencyInfoByCode = () => {
     }
 }
 
-const getCurrencyInfo = () => {
-    getChromeStorage('selectCurrencyInfo', (res) => {
-        if(res && res.currencyCode) {
-            getCurrencyInfoByCode({
-                params: {
-                    currencyCode: res.currencyCode
-                }
-            }).then(res => {
-                if(res.code == 0 && res.data) {
-                    currentCurrencyInfo.value = res.data;
-                    tempCurrentCurrencyInfo.value = res.data;
-                    onIptSetErrorTxt();
-                }
-            });
-        }
-    })
+const getCurrencyInfo = async () => {
+    let {accessToken = ''} = await getChromeStorage('userInfo') || {};
+    if (accessToken) {
+        getChromeStorage('selectCurrencyInfo', (res) => {
+            if(res && res.currencyCode) {
+                getCurrencyInfoByCode({
+                    params: {
+                        currencyCode: res.currencyCode
+                    }
+                }).then(res => {
+                    if(res.code == 0 && res.data) {
+                        currentCurrencyInfo.value = res.data;
+                        tempCurrentCurrencyInfo.value = res.data;
+                        onIptSetErrorTxt();
+                    }
+                });
+            }
+        })
+    }
 }
 
 onMounted(() => {