Skip to content

Commit

Permalink
fix: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
srindom committed Sep 29, 2024
1 parent a1fdea0 commit 9d29290
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@ export const validateShippingOptionPricesStep = createStep(
}[],
{ container }
) => {
const allPrices = options.flatMap((option) => {
if (!option.prices) {
return []
}
return option.prices
})
const allPrices = options.flatMap((option) => option.prices ?? [])

const regionIdSet = new Set<string>()

allPrices.forEach((p) => {
if ("region_id" in p && p.region_id) {
regionIdSet.add(p.region_id)
allPrices.forEach((price) => {
if ("region_id" in price && price.region_id) {
regionIdSet.add(price.region_id)
}
})

if (regionIdSet.size === 0) {
return new StepResponse(void 0)
}

const regionService = container.resolve(Modules.REGION)
const regionList = await regionService.listRegions({
id: Array.from(regionIdSet),
Expand Down

0 comments on commit 9d29290

Please sign in to comment.