fix final backend and styling
All checks were successful
Lint / Lint (push) Successful in 1m7s

This commit is contained in:
2024-10-18 14:20:58 +02:00
parent 867bd6797d
commit 620156197a
6 changed files with 103 additions and 105 deletions

View File

@ -4,18 +4,21 @@ import { z } from "zod";
import { oldestDate, signupFormSchema, youngestDate } from "@/app/sign-up/sign-up-form";
import listmonk, { listmonkData } from "./listmonk";
export async function signupFormSubmit(data: z.infer<typeof signupFormSchema>) {
export async function signupFormSubmit(data: z.infer<typeof signupFormSchema>): Promise<string> {
if (data.dob > youngestDate || data.dob < oldestDate) {
return { error: "Invalid date of birth" };
return "Invalid date of birth";
}
const offset = data.dob.getTimezoneOffset();
data.dob = new Date(data.dob.getTime() - offset * 60 * 1000);
const listmonkData: listmonkData = {
email: data.email,
name: data.name,
status: "enabled",
lists: [6],
attribs: {
dob: data.dob.toISOString(),
dob: data.dob.toISOString().split("T")[0],
},
};
listmonk(listmonkData);
return await listmonk(listmonkData);
}