From 3d699fcc4e082c8cb972e81c003516d987b004f0 Mon Sep 17 00:00:00 2001 From: Gr1ll Date: Thu, 15 Aug 2024 18:18:23 +0200 Subject: [PATCH] fix: make sure no duplicates are loaded --- apps/frontend/src/app/core/stellar/getVote.service.ts | 9 +++++++++ .../src/app/core/stellar/getVoteOption.service.ts | 9 +++++++++ .../src/app/core/stellar/getVoteResults.service.ts | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/apps/frontend/src/app/core/stellar/getVote.service.ts b/apps/frontend/src/app/core/stellar/getVote.service.ts index 8784746..19169fd 100644 --- a/apps/frontend/src/app/core/stellar/getVote.service.ts +++ b/apps/frontend/src/app/core/stellar/getVote.service.ts @@ -25,6 +25,8 @@ export class GetVoteService { sourceKeypair: Keypair, voteId: string, ) { + this.resetData() + try { const contract = new Contract(this.contractId) @@ -85,4 +87,11 @@ export class GetVoteService { errorMessage: this.errorMessage, } } + + resetData() { + this.dataArr = [] + this.isLoading = true + this.hasError = false + this.errorMessage = '' + } } diff --git a/apps/frontend/src/app/core/stellar/getVoteOption.service.ts b/apps/frontend/src/app/core/stellar/getVoteOption.service.ts index 709d47c..70cce61 100644 --- a/apps/frontend/src/app/core/stellar/getVoteOption.service.ts +++ b/apps/frontend/src/app/core/stellar/getVoteOption.service.ts @@ -25,6 +25,8 @@ export class GetVoteOptionService { sourceKeypair: Keypair, voteId: string, ) { + this.resetData() + try { const contract = new Contract(this.contractId) @@ -88,4 +90,11 @@ export class GetVoteOptionService { errorMessage: this.errorMessage, } } + + resetData() { + this.optionsArr = [] + this.isLoading = true + this.hasError = false + this.errorMessage = '' + } } diff --git a/apps/frontend/src/app/core/stellar/getVoteResults.service.ts b/apps/frontend/src/app/core/stellar/getVoteResults.service.ts index 582a322..9497c7e 100644 --- a/apps/frontend/src/app/core/stellar/getVoteResults.service.ts +++ b/apps/frontend/src/app/core/stellar/getVoteResults.service.ts @@ -25,6 +25,8 @@ export class GetVoteResultsService { sourceKeypair: Keypair, voteId: string, ) { + this.resetData() + try { const contract = new Contract(this.contractId) @@ -93,4 +95,11 @@ export class GetVoteResultsService { errorMessage: this.errorMessage, } } + + resetData() { + this.dataArr = [] + this.isLoading = true + this.hasError = false + this.errorMessage = '' + } }