Skip to content

Commit

Permalink
Merge pull request #152 from vtex-apps/fix/cost-center-address-entrie…
Browse files Browse the repository at this point in the history
…s-error

Fix getCostCenterById error when not found
  • Loading branch information
pabloppupulin authored Mar 28, 2024
2 parents ad1fd29 + 0487b51 commit 869c067
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fix

- Fix getCostCenterById query when the cost center is not found

## [0.49.0] - 2024-03-20

### Added
Expand Down
5 changes: 4 additions & 1 deletion node/resolvers/Queries/CostCenters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ const costCenters = {
id,
})

result.addresses = await addMissingAddressIds(result, ctx)
/* MasterData client returns empty string when it doesn't find the document */
if ((result as unknown as string) !== '') {
result.addresses = await addMissingAddressIds(result, ctx)
}

return result
} catch (error) {
Expand Down

0 comments on commit 869c067

Please sign in to comment.