-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added contact on website functionality, added new projects, contact pages, added technologies section inside about page, bug fixes
- Loading branch information
1 parent
08f6ece
commit f7994ee
Showing
14 changed files
with
879 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DISCORD_WEBHOOK="" # Discord Webhook URL | ||
GITHUB_TOKEN="" # Github Token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export async function POST(request) { | ||
try { | ||
const { email, firstName, lastName, message } = await request | ||
.clone() | ||
.json(); | ||
|
||
if (!email || !firstName || !lastName || !message) { | ||
return new Response("Missing required fields", { status: 400 }); | ||
} | ||
|
||
const discordWebhook = process.env.DISCORD_WEBHOOK; | ||
const webhookData = { | ||
content: `**New Contact Form Submission**`, | ||
embeds: [ | ||
{ | ||
color: 0x2f3136, | ||
fields: [ | ||
{ name: "Name", value: `${firstName} ${lastName}` }, | ||
{ name: "Email", value: email }, | ||
{ name: "Message", value: message }, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
const response = await fetch(discordWebhook, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify(webhookData), | ||
}); | ||
|
||
if (!response.ok) { | ||
return new Response("An error occurred while sending the message", { | ||
status: 500, | ||
}); | ||
} | ||
|
||
return new Response("Message sent successfully", { status: 200 }); | ||
} catch (error) { | ||
console.error(error); | ||
return new Response("An error occurred while sending the message", { | ||
status: 500, | ||
}); | ||
} | ||
} |
Oops, something went wrong.