Skip to content

Commit

Permalink
Merge pull request #5482 from kiva/resolve-country-server-error
Browse files Browse the repository at this point in the history
fix: resolve potential loan country undefined server error
  • Loading branch information
dyersituations authored Sep 6, 2024
2 parents 005a9d1 + 8ff58dd commit dca5a80
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/components/Thanks/BadgesCustomization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ export default {
loanRegion() {
return this.selectedLoan?.geocode?.country?.region ?? '';
},
loanCountryIsoCode() {
return this.selectedLoan?.geocode?.country?.isoCode ?? '';
},
},
methods: {
hash(loan) {
Expand Down Expand Up @@ -236,24 +239,26 @@ export default {
}
},
created() {
this.defaultSortBadges.unshift(
{
id: 1,
name: this.loanRegion,
img: 'region',
goals: [
`Complete 2 loans from ${this.loanCountry}`,
`Learn 1 cool thing about ${this.loanRegion}`,
],
// eslint-disable-next-line max-len
description: `Like ${this.borrowerName}, people in ${this.loanRegion} continue to be financially excluded.`,
category: {
countryIsoCode: [this.selectedLoan.geocode.country.isoCode],
},
count: 0,
tracking: `Region-${this.loanRegion}`,
}
);
if (this.loanCountryIsoCode) {
this.defaultSortBadges.unshift(
{
id: 1,
name: this.loanRegion,
img: 'region',
goals: [
`Complete 2 loans from ${this.loanCountry}`,
`Learn 1 cool thing about ${this.loanRegion}`,
],
// eslint-disable-next-line max-len
description: `Like ${this.borrowerName}, people in ${this.loanRegion} continue to be financially excluded.`,
category: {
countryIsoCode: [this.loanCountryIsoCode],
},
count: 0,
tracking: `Region-${this.loanRegion}`,
}
);
}
this.countLoansInCategories();
this.$kvTrackEvent('thanks', 'view', 'equity badge', this.isGuest ? 'guest' : 'signed-in');
},
Expand Down

0 comments on commit dca5a80

Please sign in to comment.