* ✨ refactor: streamline sitemap generation and contact form logic * ✨ refactor: update sendEmail function to handle JSON data
21 lines
477 B
TypeScript
21 lines
477 B
TypeScript
export function sendEmail(
|
|
data: string,
|
|
): Promise<{ success: boolean; message: string }> {
|
|
const apiEndpoint = "/api/email";
|
|
|
|
return fetch(apiEndpoint, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: data,
|
|
})
|
|
.then((res) => res.json())
|
|
.then((response) => {
|
|
return { success: true, message: response.message };
|
|
})
|
|
.catch((err) => {
|
|
return { success: false, message: err.message };
|
|
});
|
|
}
|