Formatted the code to accept .xlsx
This commit is contained in:
@@ -49,7 +49,7 @@ export default function BatchCodeGenerator({user}: {user: User}) {
|
|||||||
const information = uniqBy(
|
const information = uniqBy(
|
||||||
rows
|
rows
|
||||||
.map((row) => {
|
.map((row) => {
|
||||||
const [firstName, lastName, country, passport_id, email, phone] = row.map((x) => (x as string).trim());
|
const [firstName, lastName, country, passport_id, email, phone] = row as string[];
|
||||||
return EMAIL_REGEX.test(email) && !users.map((u) => u.email).includes(email)
|
return EMAIL_REGEX.test(email) && !users.map((u) => u.email).includes(email)
|
||||||
? {
|
? {
|
||||||
email,
|
email,
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
|
|
||||||
if (infos && infos.length > index) {
|
if (infos && infos.length > index) {
|
||||||
const {email, name, passport_id} = infos[index];
|
const {email, name, passport_id} = infos[index];
|
||||||
await setDoc(codeRef, {email, name, passport_id}, {merge: true});
|
await setDoc(codeRef, {email: email.trim(), name: name.trim(), passport_id: passport_id.trim()}, {merge: true});
|
||||||
|
|
||||||
const transport = prepareMailer();
|
const transport = prepareMailer();
|
||||||
const mailOptions = prepareMailOptions(
|
const mailOptions = prepareMailOptions(
|
||||||
@@ -62,7 +62,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
type,
|
type,
|
||||||
code,
|
code,
|
||||||
},
|
},
|
||||||
[email],
|
[email.trim()],
|
||||||
"EnCoach Registration",
|
"EnCoach Registration",
|
||||||
"main",
|
"main",
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user