Skip to content

Commit

Permalink
to return userId in /login
Browse files Browse the repository at this point in the history
  • Loading branch information
arogya01 committed Aug 25, 2024
1 parent e426868 commit 01adfa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export const loginHandler = async (
});

if (correctPass) {
const { password, salt, ...rest } = user;
const {userId, password, salt, ...rest } = user;

// request already has access to jwt??
// so we can just use it to sign the token,
return { accessToken: request.jwt.sign(rest) };
return { accessToken: request.jwt.sign(rest) , userId };
}

return reply.code(401).send({ message: "invalid password" });
Expand Down

0 comments on commit 01adfa5

Please sign in to comment.