Skip to content

Commit

Permalink
UIPBEX-58: Check token.conditions is defined and is an array (#121)
Browse files Browse the repository at this point in the history
(cherry picked from commit 86d717e)
  • Loading branch information
danetsao authored and zburke committed May 10, 2024
1 parent f4174b7 commit 37a0afd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/api/dto/from/dtoToData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,18 @@ export function dtoToDataToken(
};

case 'Conditional':
default:
default: {
const curConditions = Array.isArray(token.conditions) ?
token.conditions.map(condition => ({
...dtoToCriteria(condition.condition, feeFineTypes, locations, stripes, intl), value: condition.value.value
})) : [];

return {
type: DataTokenType.CONSTANT_CONDITIONAL,
conditions: token.conditions.map((condition) => ({
...dtoToCriteria(condition.condition, feeFineTypes, locations, stripes, intl),
value: condition.value.value,
})),
conditions: curConditions,
else: token.else.value,
};
}
}
}

Expand Down

0 comments on commit 37a0afd

Please sign in to comment.