Explicitly set email variable for readability
Minor code clarity tweak making the comment redundant.
This commit is contained in:
parent
ce4ed40ae0
commit
b4c96c96e6
1 changed files with 3 additions and 3 deletions
|
@ -52,15 +52,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!invitee) {
|
if (!invitee) {
|
||||||
if (!isEmail(usernameOrEmail)) {
|
const email = isEmail(usernameOrEmail) ? usernameOrEmail : undefined;
|
||||||
|
if (!email) {
|
||||||
return res.status(400).json({
|
return res.status(400).json({
|
||||||
message: `Invite failed because there is no corresponding user for ${usernameOrEmail}`,
|
message: `Invite failed because there is no corresponding user for ${usernameOrEmail}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// valid email given, create User
|
|
||||||
await prisma.user.create({
|
await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
email: usernameOrEmail,
|
email,
|
||||||
teams: {
|
teams: {
|
||||||
create: {
|
create: {
|
||||||
team: {
|
team: {
|
||||||
|
|
Loading…
Reference in a new issue