0
我不知道爲什麼我在代碼中遇到錯誤。無法讀取nodejs中未定義的屬性'then'
fineOneBySocialLogin(profile).then(function (user) {
}, function (err) {
return done(err, null);
})
var fineOneBySocialLogin = function (req, res) {
auth.findOne({ username: req.emails[0].value }).then(function (user) {
if (!user) {
console.log('testing 1');
var userForm = {};
userForm = {
email: req.emails[0].value
};
user.createUser(userForm).then(function(user) {
if (user) {
console.log('testing 2');
auth.findOne({ username: req.emails[0].value }).then(function (user) {
if (user) {
console.log('testing 3');
return user;
}
});
}
});
} else {
return user;
}
});
}
您可以更新我的代碼的答案嗎? – ppshein