added function to the login

This commit is contained in:
Kai Ritthaler 2025-06-18 15:48:53 +02:00 committed by Rudi Regentonne
parent 897e8dbed9
commit c32e345d3d
8 changed files with 292 additions and 174 deletions

View file

@ -11,8 +11,10 @@ export function validateData(schema: z.ZodObject<any, any>) {
} catch (error) {
if (error instanceof ZodError) {
const errorMessages = error.errors.map((issue: any) => ({
message: `${issue.path.join(".")} is ${issue.message}`,
}));
path: issue.path.join("."),
message: issue.message,
}));
res
.status(StatusCodes.BAD_REQUEST)
.json({ error: "Invalid data", details: errorMessages });