feat: contacts and voucher assignment
This commit is contained in:
1 parent
c86ec8bd36
commit
f2b1d0293a
8 files changed
+154
-4
No files matched your search
@@ -0,0 +1,9 @@
|
||||
export function validateContact(c: { name: string; email: string | null; telegramChatId: string | null }): string[] {
|
||||
const errs: string[] = [];
|
||||
if (!c.name?.trim()) errs.push("name");
|
||||
const email = c.email?.trim() ?? "";
|
||||
const chat = c.telegramChatId?.trim() ?? "";
|
||||
if (!email && !chat) errs.push("kanal");
|
||||
if (email && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) errs.push("email");
|
||||
return errs;
|
||||
}
|
||||
Reference in new issue
Block a user