webhook calls moved server-side

This commit is contained in:
Owen Rees
2023-09-10 20:23:42 +02:00
parent afdb57bd22
commit 4984639f23
3 changed files with 36 additions and 8 deletions
+1 -7
View File
@@ -10,12 +10,6 @@ const discordWebhook = async ({
yourEmailRef,
messageRef,
}: TournamentFormProps) => {
const webhookURL = process.env.NEXT_PUBLIC_DISCORD_WEBHOOK;
if (!webhookURL) {
throw new Error("Discord webhook URL is not defined");
}
const webhookBody = {
embeds: [
{
@@ -36,7 +30,7 @@ const discordWebhook = async ({
],
};
return await fetch(webhookURL, {
return await fetch("/api/send-discord-notification", {
method: "POST",
headers: {
"Content-Type": "application/json",