remove subject
This commit is contained in:
parent
87242aaea1
commit
7ab199b815
3 changed files with 2 additions and 21 deletions
|
|
@ -1,11 +1,6 @@
|
||||||
import { DISCORD_CONTACT_WEBHOOK } from '$env/static/private';
|
import { DISCORD_CONTACT_WEBHOOK } from '$env/static/private';
|
||||||
|
|
||||||
export async function sendContactMessage(
|
export async function sendContactMessage(name: string, email: string, message: string) {
|
||||||
name: string,
|
|
||||||
email: string,
|
|
||||||
subject: string,
|
|
||||||
message: string
|
|
||||||
) {
|
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
|
|
||||||
// We need a better way than this to format a string to markdown
|
// We need a better way than this to format a string to markdown
|
||||||
|
|
@ -13,7 +8,6 @@ export async function sendContactMessage(
|
||||||
# Someone is reaching out!
|
# Someone is reaching out!
|
||||||
|
|
||||||
From: ${name} - [${email}](mailto:${email})
|
From: ${name} - [${email}](mailto:${email})
|
||||||
> **Subject: ${subject}**
|
|
||||||
> ${message}
|
> ${message}
|
||||||
`
|
`
|
||||||
.split('\n')
|
.split('\n')
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,6 @@ export const actions = {
|
||||||
return fail(400, { email: null, missing: true });
|
return fail(400, { email: null, missing: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!form.has('subject')) {
|
|
||||||
return fail(400, { subject: null, missing: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!form.has('message')) {
|
if (!form.has('message')) {
|
||||||
return fail(400, { message: null, missing: true });
|
return fail(400, { message: null, missing: true });
|
||||||
}
|
}
|
||||||
|
|
@ -33,18 +29,13 @@ export const actions = {
|
||||||
return fail(400, { email, incorrect: true });
|
return fail(400, { email, incorrect: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
const subject = form.get('subject');
|
|
||||||
if (typeof subject !== 'string') {
|
|
||||||
return fail(400, { subject, incorrect: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
const message = form.get('message');
|
const message = form.get('message');
|
||||||
if (typeof message !== 'string') {
|
if (typeof message !== 'string') {
|
||||||
return fail(400, { message, incorrect: true });
|
return fail(400, { message, incorrect: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await sendContactMessage(name, email, subject, message);
|
const response = await sendContactMessage(name, email, message);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
response: {
|
response: {
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,6 @@
|
||||||
<Mail />
|
<Mail />
|
||||||
<input required name="email" type="email" class="grow" placeholder="Your Email" />
|
<input required name="email" type="email" class="grow" placeholder="Your Email" />
|
||||||
</label>
|
</label>
|
||||||
<label class="input input-bordered col-span-full flex w-full items-center gap-2 sm:col-span-1">
|
|
||||||
<Croissant />
|
|
||||||
<input required name="subject" type="text" class="grow" placeholder="Subject" />
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="row-span-3 sm:col-span-2">
|
<div class="row-span-3 sm:col-span-2">
|
||||||
<textarea
|
<textarea
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue