From ecfb86ce16f656dc98c89d0a51be5acdb9df27a8 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Wed, 4 Feb 2026 07:18:53 +0300 Subject: [PATCH] Merge main branch updates --- src/components/PromoDiscountBadge.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/PromoDiscountBadge.tsx b/src/components/PromoDiscountBadge.tsx index 16301d0..6bc227d 100644 --- a/src/components/PromoDiscountBadge.tsx +++ b/src/components/PromoDiscountBadge.tsx @@ -221,7 +221,14 @@ export default function PromoDiscountBadge() { }); const deactivateMutation = useMutation({ - mutationFn: promoApi.deactivateDiscount, + mutationFn: async () => { + const source = activeDiscount?.source; + if (source && source.startsWith('promocode:')) { + await promoApi.deactivateDiscount(); + } else { + await promoApi.clearActiveDiscount(); + } + }, onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['active-discount'] }); queryClient.invalidateQueries({ queryKey: ['promo-offers'] });