Explicitly set email variable for readability

Minor code clarity tweak making the comment redundant.
pull/1608/head
Alex van Andel 2022-01-26 15:51:15 +00:00 committed by Omar López
parent ce4ed40ae0
commit b4c96c96e6
1 changed files with 3 additions and 3 deletions

View File

@ -52,15 +52,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
});
if (!invitee) {
if (!isEmail(usernameOrEmail)) {
const email = isEmail(usernameOrEmail) ? usernameOrEmail : undefined;
if (!email) {
return res.status(400).json({
message: `Invite failed because there is no corresponding user for ${usernameOrEmail}`,
});
}
// valid email given, create User
await prisma.user.create({
data: {
email: usernameOrEmail,
email,
teams: {
create: {
team: {