import { z } from "zod";

export const formSchema = z
  .object({
    network: z.enum(["telegram", "whatsapp", "instagram", "discord"]),
    value: z.string().optional(),
  })
  .refine(
    (data) => {
      if (data.network === "telegram") {
        return true;
      }
      return data.value && data.value.length > 0;
    },
    {
      message: "Enter contact information",
      path: ["value"],
    },
  );

Homonyms

cyberia/research/events/client/src/features/place-form/model/formSchema.ts
cyberia/research/events/client/src/features/event-form/model/formSchema.ts
cyberia/research/events/client/src/features/localprovider-form/model/formSchema.ts
cyberia/research/events/client/src/features/staff-form/model/formSchema.ts

Graph