sync
This commit is contained in:
28
app/page.tsx
28
app/page.tsx
@@ -1,3 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, Suspense } from 'react'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import Nav from './components/Nav'
|
||||
import Drop from './components/Drop'
|
||||
import InfoBox from './components/InfoBox'
|
||||
@@ -5,9 +9,33 @@ import Signup from './components/Signup'
|
||||
import PastDrops from './components/PastDrops'
|
||||
import Footer from './components/Footer'
|
||||
|
||||
function PaymentHandler() {
|
||||
const searchParams = useSearchParams()
|
||||
|
||||
useEffect(() => {
|
||||
const payment = searchParams.get('payment')
|
||||
const orderId = searchParams.get('order_id')
|
||||
|
||||
if (payment === 'success' && orderId) {
|
||||
// Clean up URL - IPN is handled by external service
|
||||
window.history.replaceState({}, '', window.location.pathname)
|
||||
} else if (payment === 'cancelled') {
|
||||
alert('Payment was cancelled.')
|
||||
// Clean up URL
|
||||
window.history.replaceState({}, '', window.location.pathname)
|
||||
}
|
||||
}, [searchParams])
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Suspense fallback={null}>
|
||||
<PaymentHandler />
|
||||
</Suspense>
|
||||
<Nav />
|
||||
<header className="container">
|
||||
<h1>Shop together. Wholesale prices for private buyers.</h1>
|
||||
|
||||
Reference in New Issue
Block a user