Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JazzarKarim committed Dec 5, 2023
1 parent efb8cdb commit 2d6fe6f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/components/Amalgamation/AmalgamatingBusinesses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,20 @@ export default class AmalgamatingBusinesses extends Mixins(CommonMixin) {
business = data[0].data?.business
business.businessContact = data[1].contacts[0]
business.officeAddress = data[2]
} else {
business = businessLookup
}
// If the business is not null (LEAR Entity)
// If the amalgamating businesses array is not empty, check if identifier already exists.
// If identifier already exists, don't add the business to the array.
if (this.amalgamatingBusinesses.length > 0) {
const businessExists = this.amalgamatingBusinesses.find(function (id) {
return id.identifier === business.identifier
})
if (!businessExists) this.amalgamatingBusinesses.push(business)
} else {
this.amalgamatingBusinesses.push(business)
if (business) {
if (this.amalgamatingBusinesses) {
const businessExists = this.amalgamatingBusinesses.find(
(id) => id.identifier === business.identifier
)
if (!businessExists) this.amalgamatingBusinesses.push(business)
} else {
this.amalgamatingBusinesses.push(business)
}
}
// Set the amalgamated businesses array in the store.
Expand Down

0 comments on commit 2d6fe6f

Please sign in to comment.