| 1 | "use client"; |
| 2 | |
| 3 | import { HeroSection } from "@/components/hero-section"; |
| 4 | import { PricingSection } from "@/components/pricing-section"; |
| 5 | import { Button } from "@/components/ui/button"; |
| 6 | import { api } from "@/lib/api"; |
| 7 | import stripePromise from "@/lib/stripe"; |
| 8 | |
| 9 | export default function Home() { |
| 10 | const handleUpgrade = async () => { |
| 11 | try { |
| 12 | const response = await api.get("/payments/create-checkout-session"); |
| 13 | const stripe = await stripePromise; |
| 14 | await stripe?.redirectToCheckout({ |
| 15 | sessionId: response.data.sessionId, |
| 16 | }); |
| 17 | } catch (error) { |
| 18 | console.error(error); |
| 19 | } |
| 20 | }; |
| 21 | |
| 22 | return ( |
| 23 | <> |
| 24 | <HeroSection /> |
| 25 | <PricingSection /> |
| 26 | </> |
| 27 | ); |
| 28 | } |