From fec2c8c789b06eb974867e3f250b7cf1953c81f0 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Wed, 25 Jun 2025 01:34:47 +0530 Subject: [PATCH] client error fix --- app/components/PaymentModal.tsx | 2 +- app/lib/stripe-client.ts | 7 +++++++ app/lib/stripe.ts | 7 ------- 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 app/lib/stripe-client.ts diff --git a/app/components/PaymentModal.tsx b/app/components/PaymentModal.tsx index 9191885..fda68c1 100644 --- a/app/components/PaymentModal.tsx +++ b/app/components/PaymentModal.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import { useAuth } from '../context/AuthContext'; -import { getStripe } from '../lib/stripe'; +import { getStripe } from '../lib/stripe-client'; interface PaymentModalProps { isOpen: boolean; diff --git a/app/lib/stripe-client.ts b/app/lib/stripe-client.ts new file mode 100644 index 0000000..dd0dcb4 --- /dev/null +++ b/app/lib/stripe-client.ts @@ -0,0 +1,7 @@ +import { loadStripe } from '@stripe/stripe-js'; + +// Initialize Stripe on the client +export const getStripe = () => { + const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!); + return stripePromise; +}; \ No newline at end of file diff --git a/app/lib/stripe.ts b/app/lib/stripe.ts index 8d4e585..94f8226 100644 --- a/app/lib/stripe.ts +++ b/app/lib/stripe.ts @@ -1,12 +1,5 @@ -import { loadStripe } from '@stripe/stripe-js'; import { headers } from 'next/headers'; -// Initialize Stripe on the client -export const getStripe = () => { - const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!); - return stripePromise; -}; - // Helper function to create a payment intent (server-side only) export async function createPaymentIntent(amount: number, currency: string = 'usd') { try {