Server Code
async function handleSubmit(formData: FormData) {
"use server";
const name = formData.get("name");
const email = formData.get("email");
const message = formData.get("message");
const res = await fetch("https://www.selfping.com/api/sms", {
method: "POST",
body: JSON.stringify({
message:
name +
" submitted your contact form with " +
"email: " +
email +
" and message: " +
message,
}),
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + process.env.SELFPING_API_KEY,
},
});