check for undefined
Some checks failed
PR Gate / Checks (pull_request) Failing after 39s

This commit is contained in:
Benjamin Palko 2026-08-11 20:46:35 -04:00
parent 37d44b6216
commit 462cd5483a

View file

@ -16,5 +16,10 @@ export async function sendContactMessage(name: string, email: string, message: s
form.append('content', content);
return await fetch(env.DISCORD_CONTACT_WEBHOOK, { method: 'POST', body: form });
if (!env.DISCORD_CONTACT_WEBHOOK) {
return;
}
const url = new URL(env.DISCORD_CONTACT_WEBHOOK);
return await fetch(url, { method: 'POST', body: form });
}