Update src/app/page.tsx
This commit is contained in:
@@ -18,6 +18,23 @@ export default function LandingPage() {
|
||||
window.location.href = "tel:5867959955";
|
||||
};
|
||||
|
||||
const handleRequestService = async (email: string) => {
|
||||
try {
|
||||
const response = await fetch('/api/request-service', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email, type: 'Request Service' }),
|
||||
});
|
||||
if (response.ok) {
|
||||
alert('Service request sent successfully!');
|
||||
} else {
|
||||
alert('Failed to send request.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="bounce-effect"
|
||||
@@ -214,6 +231,7 @@ export default function LandingPage() {
|
||||
description="Call us at (586) 795-9955 for urgent plumbing help."
|
||||
mediaAnimation="slide-up"
|
||||
imageSrc="http://img.b2bpic.net/free-photo/plumbing-professional-doing-his-job_23-2150721535.jpg"
|
||||
onSubmit={handleRequestService}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -252,4 +270,4 @@ export default function LandingPage() {
|
||||
</ReactLenis>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user