Skip to content

Convert user.controller.js to async/await syntax. #3032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ passport.use(
done(null, false, { msg: accountSuspensionMessage });
return;
}
user.comparePassword(password, (innerErr, isMatch) => {
user.comparePassword(password).then((isMatch) => {
Copy link
Contributor

@Swarnendu0123 Swarnendu0123 Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use async await syntax here also.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure. I figured I’d convert the passport file in a separate PR. So I made the minimum change to keep it working for now.

if (isMatch) {
done(null, user);
return;
} else {
done(null, false, { msg: 'Invalid email or password.' });
}
done(null, false, { msg: 'Invalid email or password.' });
});
})
.catch((err) => done(null, false, { msg: err }));
Expand Down
Loading