You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if anyone face the above situation use promise instead of a callback function
for example :
// User.findOne({ email: username }, function (err, foundUser) {
// if (err) {
// console.log(err);
// } else {
// if (foundUser.password === password) {
// res.render("secrets");
// }
// }
// });
the above code can be rewritten using promises below
User.findOne({ email: username })
.then((foundUser) => {
if (foundUser.password === password) {
res.render("secrets");
}
})
The text was updated successfully, but these errors were encountered:
if anyone face the above situation use promise instead of a callback function
for example :
// User.findOne({ email: username }, function (err, foundUser) {
// if (err) {
// console.log(err);
// } else {
// if (foundUser.password === password) {
// res.render("secrets");
// }
// }
// });
the above code can be rewritten using promises below
User.findOne({ email: username })
.then((foundUser) => {
if (foundUser.password === password) {
res.render("secrets");
}
})
The text was updated successfully, but these errors were encountered: