Skip to content

Commit 47300e0

Browse files
committed
fix: minor updates
1 parent b69f7cc commit 47300e0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

app/routes/api/auth.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ authRouter.post(
3535
where: { email: body.email }
3636
})
3737

38-
if (isUserExists) {
39-
return next(Conflict('Email already exist'))
40-
}
38+
if (isUserExists) return next(Conflict('Email already exist'))
4139

4240
const user = await prisma.user.create({
4341
data: {
@@ -65,17 +63,13 @@ authRouter.post(
6563
where: { email: body.email }
6664
})
6765

68-
if (!user) {
69-
return next(Unauthorized('Email or password invalid'))
70-
}
66+
if (!user) return next(Unauthorized('Email or password invalid'))
7167

7268
const { password, ...userWithoutPassword } = user
7369

7470
const isPasswordMatch = await compare(body.password, password)
7571

76-
if (!isPasswordMatch) {
77-
return next(Unauthorized('Email or password invalid'))
78-
}
72+
if (!isPasswordMatch) return next(Unauthorized('Email or password invalid'))
7973

8074
const newSession = await prisma.session.create({
8175
data: { userId: user.id }

0 commit comments

Comments
 (0)