Skip to content

Commit

Permalink
fix: make sure no duplicates are loaded (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gr1ll authored Aug 15, 2024
1 parent 4ab4b53 commit aec417f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/frontend/src/app/core/stellar/getVote.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class GetVoteService {
sourceKeypair: Keypair,
voteId: string,
) {
this.resetData()

try {
const contract = new Contract(this.contractId)

Expand Down Expand Up @@ -85,4 +87,11 @@ export class GetVoteService {
errorMessage: this.errorMessage,
}
}

resetData() {
this.dataArr = []
this.isLoading = true
this.hasError = false
this.errorMessage = ''
}
}
9 changes: 9 additions & 0 deletions apps/frontend/src/app/core/stellar/getVoteOption.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class GetVoteOptionService {
sourceKeypair: Keypair,
voteId: string,
) {
this.resetData()

try {
const contract = new Contract(this.contractId)

Expand Down Expand Up @@ -88,4 +90,11 @@ export class GetVoteOptionService {
errorMessage: this.errorMessage,
}
}

resetData() {
this.optionsArr = []
this.isLoading = true
this.hasError = false
this.errorMessage = ''
}
}
9 changes: 9 additions & 0 deletions apps/frontend/src/app/core/stellar/getVoteResults.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class GetVoteResultsService {
sourceKeypair: Keypair,
voteId: string,
) {
this.resetData()

try {
const contract = new Contract(this.contractId)

Expand Down Expand Up @@ -93,4 +95,11 @@ export class GetVoteResultsService {
errorMessage: this.errorMessage,
}
}

resetData() {
this.dataArr = []
this.isLoading = true
this.hasError = false
this.errorMessage = ''
}
}

0 comments on commit aec417f

Please sign in to comment.