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