Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4c5d9a95b | |||
| bccae5505b | |||
| 66cbad4957 | |||
| 2376eb5281 | |||
| a1a648b518 | |||
| c94b4a1c21 | |||
| 0e6eef1ea7 |
@@ -19,9 +19,27 @@ 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}`);
|
||||
window.open(`https://wa.me/919876543210?text=${message}`, '_blank');
|
||||
|
||||
// Send email via API request
|
||||
try {
|
||||
const response = await fetch('/api/send-booking', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ name, email, mobile, guests, to: 'isittrueorjust@gmail.com' }),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error("Server error during booking submission");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to send email", e);
|
||||
}
|
||||
|
||||
window.open(`https://wa.me/919592524646?text=${message}`, '_blank');
|
||||
setIsReserving(false);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user