diff --git a/src/app/page.tsx b/src/app/page.tsx index 76fba4b..0ffb211 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -19,8 +19,19 @@ export default function LandingPage() { const [name, setName] = useState(""); const [guests, setGuests] = useState("2"); - const handleReserve = () => { + const handleReserve = async () => { const message = encodeURIComponent(`Hello, I would like to book a table at Shaffa. \nName: ${name}\nEmail: ${email}\nMobile: ${mobile}\nGuests: ${guests}`); + + // Send email via simple API request + try { + await fetch('/api/send-booking', { + method: 'POST', + body: JSON.stringify({ name, email, mobile, guests, to: 'isittrueorjust@gmail.com' }), + }); + } catch (e) { + console.error("Failed to send email", e); + } + window.open(`https://wa.me/919876543210?text=${message}`, '_blank'); setIsReserving(false); }; @@ -196,4 +207,4 @@ export default function LandingPage() { ); -} \ No newline at end of file +}