Skip to content

Commit

Permalink
Fix ticket tab display + code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
GusevPM committed Sep 21, 2023
1 parent fec6571 commit 143eaea
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 47 deletions.
4 changes: 0 additions & 4 deletions src/components/Bookmarks/BookmarkButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,3 @@ export default {
}
}
</script>


<style scoped>
</style>
4 changes: 0 additions & 4 deletions src/components/Bookmarks/Bookmarks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,3 @@ export default {
}
}
</script>


<style scoped>
</style>
73 changes: 35 additions & 38 deletions src/views/contract/Contract.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export default {
},
data: () => ({
accountType: '',
contractLoading: true,
contract: {},
contractInfo: {},
balance: 0,
Expand Down Expand Up @@ -181,7 +180,6 @@ export default {
showClipboardOK: "showClipboardOK",
}),
loadOnChainViews() {
this.onChainViews = [];
if (!this.network || !this.address) {
return
}
Expand Down Expand Up @@ -211,19 +209,24 @@ export default {
handleSearchBoxBlur() {
this.isComboBoxExpanded = false;
},
async init() {
await this.getInfo();
this.tokensTotal = 0;
this.metadata = null;
init() {
this
.getInfo()
.then((res) => {
this.handleInfo(res);
this.alias = await this.getAlias(this.network, this.address);
if (this.isContract) {
this.getContract();
this.loadOnChainViews();
} else {
this.contract = this.contractInfo;
}
this.getMetadata();
return this.getAlias(this.network, this.address);
})
.then((alias) => {
this.alias = alias;
return;
})
.then(() => {
this.fetchContractData();
})
.catch((err) => {
this.showError(err);
})
},
getContract() {
if (
Expand All @@ -232,7 +235,6 @@ export default {
) {
return;
}
this.contractLoading = true;
this.api
.getContract(this.network, this.address)
.then((res) => {
Expand All @@ -248,31 +250,26 @@ export default {
this.showError(err);
}
})
.finally(() => (this.contractLoading = false));
},
fetchContractData() {
if (this.isContract) {
this.getContract();
this.loadOnChainViews();
} else {
this.contract = this.contractInfo;
}
this.getMetadata();
},
getInfo() {
this.contractLoading = true;
this.api
.getAccountInfo(this.network, this.address)
.then((res) => {
if (!res) return;
this.contractInfo = res;
this.accountType = res.account_type;
if (res.balance !== undefined) {
this.balance = res.balance || 0;
return;
}
return this.rpc.getTezosBalance(this.network, 'head', this.address);
})
.then((res) => {
if (!res) return;
this.balance = res.balance || 0;
})
.catch((err) => {
this.showError(err);
})
.finally(() => (this.contractLoading = false));
return this.api.getAccountInfo(this.network, this.address)
},
handleInfo(info) {
if (!info) return;
this.contractInfo = info;
this.accountType = info.account_type;
if (info.balance !== undefined) {
this.balance = info.balance || 0;
}
},
getMetadata() {
if (!this.metadataService.created()) return;
Expand Down
1 change: 0 additions & 1 deletion src/views/contract/TicketTab/TicketTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export default {
this.getTickectUpdatesByOperation(this.network, this.operationId);
}
},
// Не понял секцию ниже..
watch: {
'address': function(newAddress){
this.updates = [];
Expand Down

0 comments on commit 143eaea

Please sign in to comment.