From c6cb63bb45ca3ea96b21d19b620a5de3edd40541 Mon Sep 17 00:00:00 2001 From: nflnkr <105123049+nflnkr@users.noreply.github.com> Date: Mon, 11 Mar 2024 21:27:06 +0300 Subject: [PATCH] total price at custom tariff page show cart price --- src/pages/TariffConstructor/TariffConstructor.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/TariffConstructor/TariffConstructor.tsx b/src/pages/TariffConstructor/TariffConstructor.tsx index 5099084..45c59f0 100644 --- a/src/pages/TariffConstructor/TariffConstructor.tsx +++ b/src/pages/TariffConstructor/TariffConstructor.tsx @@ -10,18 +10,17 @@ import { serviceNameByKey } from "@root/utils/serviceKeys" import { useHistoryTracker } from "@root/utils/hooks/useHistoryTracker" import { withErrorBoundary } from "react-error-boundary" import { handleComponentError } from "@root/utils/handleComponentError" +import { useCart } from "@root/utils/hooks/useCart"; function TariffConstructor() { const theme = useTheme() const upMd = useMediaQuery(theme.breakpoints.up("md")) const isTablet = useMediaQuery(theme.breakpoints.down(1000)) - + const cart = useCart(); const customTariffs = useCustomTariffsStore((state) => state.privilegeByService) - const summaryPriceBeforeDiscountsMap = useCustomTariffsStore((state) => state.summaryPriceBeforeDiscountsMap) - const summaryPriceAfterDiscountsMap = useCustomTariffsStore((state) => state.summaryPriceAfterDiscountsMap) - const basePrice = Object.values(summaryPriceBeforeDiscountsMap).reduce((a, e) => a + e, 0) - const discountedPrice = Object.values(summaryPriceAfterDiscountsMap).reduce((a, e) => a + e, 0) + const basePrice = cart.priceBeforeDiscounts + const discountedPrice = cart.priceAfterDiscounts const handleCustomBackNavigation = useHistoryTracker()