mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
Update PromoDiscountBadge.tsx
This commit is contained in:
@@ -221,12 +221,13 @@ export default function PromoDiscountBadge() {
|
||||
});
|
||||
|
||||
const deactivateMutation = useMutation({
|
||||
mutationFn: () => {
|
||||
mutationFn: async () => {
|
||||
const source = activeDiscount?.source;
|
||||
if (source && source.startsWith('promocode:')) {
|
||||
return promoApi.deactivateDiscount();
|
||||
await promoApi.deactivateDiscount();
|
||||
} else {
|
||||
await promoApi.clearActiveDiscount();
|
||||
}
|
||||
return promoApi.clearActiveDiscount();
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['active-discount'] });
|
||||
|
||||
Reference in New Issue
Block a user