Skip to content

Commit

Permalink
clear selected offers after deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix-Asante committed Jan 1, 2024
1 parent b3b6226 commit c93f7cd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app/(dashboard)/specials/_sections/OffersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default function OffersTable({ offers }: Props) {
}
await runDeleteOffer(offerId);
toast.success("Offer deleted successfully");
setSelectedOffer(null);
} catch (error) {
toast.error(getErrorMessage(error));
}
Expand All @@ -79,6 +80,7 @@ export default function OffersTable({ offers }: Props) {
offerIds = [...selectedOffers];
}
await Promise.all(offerIds?.map((offer) => removeOffer(offer)));
setSelectedOffers(new Set([]));
} catch (error) {
toast.error(getErrorMessage(error));
}
Expand Down

0 comments on commit c93f7cd

Please sign in to comment.