diff --git a/CHANGELOG.md b/CHANGELOG.md index 26ec83af7..5bb57de0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable, unreleased changes to this project will be documented in this file. - Improve mobile appearance - #240 by @benekex2 and @dominik-zeglen - Use searches as hooks instead of components - #262 by @dominik-zeglen - Add navigator - #267 by @dominik-zeglen +- Fix voucher limit - #271 by @dominik-zeglen ## 2.0.0 diff --git a/src/discounts/components/VoucherList/VoucherList.tsx b/src/discounts/components/VoucherList/VoucherList.tsx index 45afba2d3..83e2e4382 100644 --- a/src/discounts/components/VoucherList/VoucherList.tsx +++ b/src/discounts/components/VoucherList/VoucherList.tsx @@ -220,11 +220,9 @@ const VoucherList: React.FC = props => { )} - {voucher && voucher.usageLimit ? ( - voucher.usageLimit - ) : voucher && voucher.usageLimit === null ? ( - "-" - ) : ( + {maybe( + () => + voucher.usageLimit === null ? "-" : voucher.usageLimit, )} diff --git a/src/discounts/views/VoucherDetails.tsx b/src/discounts/views/VoucherDetails.tsx index 8bf6fe9b3..005120de2 100644 --- a/src/discounts/views/VoucherDetails.tsx +++ b/src/discounts/views/VoucherDetails.tsx @@ -381,7 +381,7 @@ export const VoucherDetails: React.FC = ({ : formData.type, usageLimit: formData.hasUsageLimit ? parseInt(formData.usageLimit, 10) - : 0 + : null } } })