General Updates

This commit is contained in:
Ahmad 2024-09-27 22:53:25 -04:00
parent d4586b1fa5
commit beb661143b
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
4 changed files with 12 additions and 7 deletions

View file

@ -1,6 +1,7 @@
'use client';
import { toast } from 'sonner';
import { useRouter } from 'next/navigation';
import { stripeRedirect } from '@/actions/stripe-redirect';
import { Button } from '@/components/ui/button';
@ -13,10 +14,11 @@ interface SubscriptionButtonProps {
export const SubscriptionButton = ({ isPro }: SubscriptionButtonProps) => {
const proModal = useProModal();
const router = useRouter();
const { execute, isLoading } = useAction(stripeRedirect, {
onSuccess: (data) => {
window.location.href = data;
router.push(data);
},
onError: (error) => {
toast.error(error);