Removed the need for it to alway use Passport ID
This commit is contained in:
@@ -42,7 +42,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
const {type, codes, infos, expiryDate} = req.body as {
|
||||
type: Type;
|
||||
codes: string[];
|
||||
infos?: {email: string; name: string; passport_id: string}[];
|
||||
infos?: {email: string; name: string; passport_id?: string}[];
|
||||
expiryDate: null | Date;
|
||||
};
|
||||
const permission = PERMISSIONS.generateCode[type];
|
||||
@@ -74,7 +74,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
if (infos && infos.length > index) {
|
||||
const {email, name, passport_id} = infos[index];
|
||||
await setDoc(codeRef, {email: email.trim(), name: name.trim(), passport_id: passport_id.trim()}, {merge: true});
|
||||
await setDoc(codeRef, {email: email.trim(), name: name.trim(), ...(passport_id ? {passport_id: passport_id.trim()} : {})}, {merge: true});
|
||||
|
||||
const transport = prepareMailer();
|
||||
const mailOptions = prepareMailOptions(
|
||||
|
||||
Reference in New Issue
Block a user