From 89345a3d1d7201272bff1b4e4a8ffb4fcf5b3e9e Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 22 Aug 2024 10:15:35 +0700 Subject: add ? to data fetch --- src-migrate/modules/promo/components/Voucher.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src-migrate/modules/promo/components/Voucher.tsx') diff --git a/src-migrate/modules/promo/components/Voucher.tsx b/src-migrate/modules/promo/components/Voucher.tsx index e5877e51..510fe746 100644 --- a/src-migrate/modules/promo/components/Voucher.tsx +++ b/src-migrate/modules/promo/components/Voucher.tsx @@ -56,7 +56,7 @@ const VoucherComponent = () => { spaceBetween: 2, }; - const dataVouchers = useMemo(() => voucherQuery.data || [], [voucherQuery.data]); + const dataVouchers = useMemo(() => voucherQuery?.data || [], [voucherQuery?.data]); const vouchers = auth?.id? listVouchers : dataVouchers; @@ -121,30 +121,30 @@ const VoucherComponent = () => {
- {voucherQuery.isLoading && ( + {voucherQuery?.isLoading && (
{Array.from({ length: 3 }).map((_, index) => (
))}
)} - {!voucherQuery.isLoading && ( + {!voucherQuery?.isLoading && (
{vouchers?.map((voucher) => (
- {voucher.name} + {voucher?.name}
-
{voucher.name}
-
{voucher.description}
+
{voucher?.name}
+
{voucher?.description}
Kode Promo
-
{voucher.code}
+
{voucher?.code}
- +
-- cgit v1.2.3