Move from TRPC to server actions

This commit is contained in:
Timothy Armes
2024-04-08 09:48:18 +02:00
parent cd83db2385
commit 0540ecc05a
25 changed files with 1802 additions and 1774 deletions
@@ -12,14 +12,13 @@ import { clearMessage } from "@/components/InfoMessage";
import { TextAreaField } from "@/components/form/TextAreaField";
import { TextField } from "@/components/form/TextField";
import { contactUsSchema } from "@/schemas";
import { trpc } from "@/utils/trpc";
import { contactUs } from "@/server/contactUs";
type TournamentFormValues = z.infer<typeof contactUsSchema>;
const ContactForm = () => {
const t = useTranslations("Contact");
const contactUs = trpc.contactUs.useMutation();
const [responseMessage, setResponseMessage] = useState({
isSuccessful: false,
message: "",
@@ -31,7 +30,7 @@ const ContactForm = () => {
const onSubmit = async (data: TournamentFormValues) => {
try {
await contactUs.mutateAsync(data);
await contactUs(data);
setResponseMessage({
isSuccessful: true,
message: t("success"),