mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-01-31 00:53:37 +00:00
General Updates
This commit is contained in:
parent
d4586b1fa5
commit
beb661143b
4 changed files with 12 additions and 7 deletions
|
@ -38,7 +38,7 @@ const handler = async (data: InputType): Promise<ReturnType> => {
|
||||||
const stripeSession = await stripe.checkout.sessions.create({
|
const stripeSession = await stripe.checkout.sessions.create({
|
||||||
success_url: settingsUrl,
|
success_url: settingsUrl,
|
||||||
cancel_url: settingsUrl,
|
cancel_url: settingsUrl,
|
||||||
// payment_method_types: ['card', 'paypal'],
|
payment_method_types: ['card', 'paypal'],
|
||||||
mode: 'subscription',
|
mode: 'subscription',
|
||||||
billing_address_collection: 'auto',
|
billing_address_collection: 'auto',
|
||||||
customer_email: user.emailAddresses[0].emailAddress,
|
customer_email: user.emailAddresses[0].emailAddress,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
import { stripeRedirect } from '@/actions/stripe-redirect';
|
import { stripeRedirect } from '@/actions/stripe-redirect';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
@ -13,10 +14,11 @@ interface SubscriptionButtonProps {
|
||||||
|
|
||||||
export const SubscriptionButton = ({ isPro }: SubscriptionButtonProps) => {
|
export const SubscriptionButton = ({ isPro }: SubscriptionButtonProps) => {
|
||||||
const proModal = useProModal();
|
const proModal = useProModal();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const { execute, isLoading } = useAction(stripeRedirect, {
|
const { execute, isLoading } = useAction(stripeRedirect, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
window.location.href = data;
|
router.push(data);
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast.error(error);
|
toast.error(error);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
||||||
import { useProModal } from '@/hooks/use-pro-modal';
|
import { useProModal } from '@/hooks/use-pro-modal';
|
||||||
|
@ -11,10 +12,11 @@ import { stripeRedirect } from '@/actions/stripe-redirect';
|
||||||
|
|
||||||
export const ProModal = () => {
|
export const ProModal = () => {
|
||||||
const proModal = useProModal();
|
const proModal = useProModal();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const { execute, isLoading } = useAction(stripeRedirect, {
|
const { execute, isLoading } = useAction(stripeRedirect, {
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
window.location.href = data;
|
router.push(data);
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast.error(error);
|
toast.error(error);
|
||||||
|
|
|
@ -4,7 +4,8 @@ declare global {
|
||||||
interface Liveblocks {
|
interface Liveblocks {
|
||||||
// Each user's Presence, for useMyPresence, useOthers, etc.
|
// Each user's Presence, for useMyPresence, useOthers, etc.
|
||||||
Presence: {
|
Presence: {
|
||||||
cursor: { x: number; y: number } | null;
|
// Example, real-time cursor coordinates
|
||||||
|
cursor: { x: number; y: number };
|
||||||
};
|
};
|
||||||
|
|
||||||
// The Storage tree for the room, for useMutation, useStorage, etc.
|
// The Storage tree for the room, for useMutation, useStorage, etc.
|
||||||
|
|
Loading…
Reference in a new issue