Update packages

This commit is contained in:
Timothy Armes
2024-10-21 15:19:28 +02:00
parent 75fd05a3d7
commit 1c7ad63e03
33 changed files with 1822 additions and 1351 deletions
+30 -28
View File
@@ -5,32 +5,34 @@ import { z } from "zod";
import { contactUsSchema } from "@/schemas";
import { errorLog } from "@/utils/logger";
import { action } from "./safeAction";
import { actionClient } from "./safeAction";
export const contactUs = action(contactUsSchema, async (input) => {
try {
const { email, subject, message } = input;
await fetch(process.env.DISCORD_WEBHOOK_CONTACT_URL as string, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
embeds: [
{
title: "Contact",
fields: [
{ name: "Email", value: email },
{ name: "Subject", value: subject },
{ name: "Message", value: message },
],
},
],
}),
});
return true;
} catch (error) {
errorLog(error);
throw error;
}
});
export const contactUs = actionClient
.schema(contactUsSchema)
.action(async (input) => {
try {
const { email, subject, message } = input.parsedInput;
await fetch(process.env.DISCORD_WEBHOOK_CONTACT_URL as string, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
embeds: [
{
title: "Contact",
fields: [
{ name: "Email", value: email },
{ name: "Subject", value: subject },
{ name: "Message", value: message },
],
},
],
}),
});
return true;
} catch (error) {
errorLog(error);
throw error;
}
});