Skip to content

Commit

Permalink
[FeatFix] fix auto refresh transaction for contract detail page (#3455)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamvb2391 authored May 31, 2024
1 parent bba0ec2 commit 10a32a8
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export class ContractTableComponent implements OnInit, OnChanges {
isMoreTx = false;
lengthAddress = LENGTH_CHARACTER.ADDRESS;

timerRefress: any;

constructor(
public translate: TranslateService,
private environmentService: EnvironmentService,
Expand All @@ -86,6 +88,23 @@ export class ContractTableComponent implements OnInit, OnChanges {
) {}

ngOnChanges(): void {
this.getListTransaction();
}

ngOnInit(): void {
this.displayedColumns = this.templates?.map((dta) => dta.matColumnDef);
this.timerRefress = setInterval(() => {
if (this.pageData.pageIndex === 1) {
this.getListTransaction();
}
}, 30000);
}

ngOnDestroy(): void {
clearInterval(this.timerRefress);
}

getListTransaction() {
if (this.dataList?.data) {
if (this.contractInfo.contractsAddress.startsWith(EWalletType.EVM)) {
this.getListEVMContractTransaction();
Expand All @@ -98,10 +117,6 @@ export class ContractTableComponent implements OnInit, OnChanges {
}
}

ngOnInit(): void {
this.displayedColumns = this.templates?.map((dta) => dta.matColumnDef);
}

loadTableData() {
this.pageData = {
length: this.dataList.count,
Expand Down

0 comments on commit 10a32a8

Please sign in to comment.