OSDN Git Service

update the new api address
[bytom/Byone.git] / src / views / home.vue
index 8a3ff85..a5346b7 100644 (file)
@@ -82,7 +82,7 @@
 }
 .transactions {
   font-size: 15px;
-  height: 340px;
+  height: 283px;
   overflow: auto;
 }
 .list-item {
                 <div class="value">{{ itemBalance(asset) }}</div>
                 <div class="addr color-grey">{{ formatCurrency(asset[ currency ]) }}</div>
               </div>
-              <div v-if="asset.symbol">
+              <div v-if="asset.symbol!== '-'">
                 <div class="uppercase">
                   {{asset.symbol}}
                 </div>
                   <div class="value">{{ itemBalance(asset) }}</div>
                   <div class="addr color-grey">{{ formatCurrency(asset[ currency ]) }}</div>
                 </div>
-                <div v-if="asset.symbol">
+                <div v-if="asset.symbol!== '-'">
                   <div class="uppercase">
                     {{asset.symbol}}
                   </div>
@@ -404,8 +404,6 @@ export default {
         netTypeToggle: function (event) {
             const newNetType = event.target.value  ==='bytom'? '' :event.target.value;
 
-            console.log(newNetType)
-          console.log(this.netType)
             if( newNetType !== this.netType){
               const bytom = this.bytom.clone();
 
@@ -421,12 +419,30 @@ export default {
                   const objectIndex = bytom.accountList.findIndex(a => a.guid == this.currentAccount.guid)
                   bytom.accountList[objectIndex].vpAddress = accounts.vpAddress
 
-                  this[Actions.UPDATE_STORED_BYTOM](bytom)
+                  this[Actions.UPDATE_STORED_BYTOM](bytom).then(()=>{
+                    this.refreshBalance(this.currentAccount.guid)
+                  })
+                }).catch(e =>{
+                  if(e.message == 'Error: wallet has exist'){
+                    account.listVapor(this.currentAccount.guid).then(accounts => {
+                      //update currentAccount
+                      bytom.currentAccount = accounts
+
+                      const objectIndex = bytom.accountList.findIndex(a => a.guid == this.currentAccount.guid)
+                      bytom.accountList[objectIndex].vpAddress = accounts.vpAddress
+
+                      this[Actions.UPDATE_STORED_BYTOM](bytom).then(()=>{
+                        this.refreshBalance(this.currentAccount.guid)
+                      })
+                    })
+
+                  }
                 })
               }else{
-                this[Actions.UPDATE_STORED_BYTOM](bytom)
+                this[Actions.UPDATE_STORED_BYTOM](bytom).then(()=>{
+                  this.refreshBalance(this.currentAccount.guid)
+                })
               }
-              this.refreshBalance(this.currentAccount.guid)
             }
         },
         showQrcode: function () {