Skip to content

Commit

Permalink
Add: filter logic for "pickup" addressType
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrizmaselli committed Jun 21, 2024
1 parent 56825e5 commit 98ae17b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Filter out "pickup" addresses type temporarily while is still being saved at Profile V2.

## [2.170.2] - 2024-05-02

### Changed
Expand Down
10 changes: 9 additions & 1 deletion node/resolvers/profile/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ export function getAddresses(context: Context, currentUserProfile?: Profile) {
vtex: { currentProfile },
} = context

return profile.getUserAddresses(currentProfile, context, currentUserProfile)
// Filter out temporarily addresses with addressType "pickup" because its also saved at Profile V2
return profile
.getUserAddresses(currentProfile, context, currentUserProfile)
.then((addresses: any[]) => {
const residentialAddresses = addresses.filter(
(address: { addressType: string }) => address.addressType !== 'pickup'
)
return residentialAddresses
})
}

export async function getPayments(context: Context) {
Expand Down

0 comments on commit 98ae17b

Please sign in to comment.