Skip to content

Commit

Permalink
Refactor Payment component to use toast for successful payment and in…
Browse files Browse the repository at this point in the history
…validate coupon code
  • Loading branch information
Vyshnav001 committed Oct 3, 2024
1 parent 48dc588 commit 4ab6dea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { basePrice, initialdiscount } from "@/constants";
import Script from "next/script";
import { ConfettiSideCannons } from "./confetti-display";
import { toast } from "sonner";
import { invalidateCouponCode } from "@/app/actions/invalidate-coupon";

declare global {
interface Window {
Expand Down Expand Up @@ -69,7 +70,8 @@ export function Payment() {
const data = await resp.json();
console.log(data);
if (data.isOk) {
alert("Payment sucessfull");
toast.success("Payment sucessfull");
await invalidateCouponCode(coupon);
setTrigger(!trigger);
setIsSuccess(true);
} else {
Expand Down

0 comments on commit 4ab6dea

Please sign in to comment.