diff options
| -rw-r--r-- | node_simple.js | 8 | ||||
| -rw-r--r-- | routes/index.js | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/node_simple.js b/node_simple.js index 5d40b11..b2321f2 100644 --- a/node_simple.js +++ b/node_simple.js @@ -130,19 +130,20 @@ exports.add_user = function (fields, callbackUser) { var users = db.collection('users'); var logins = db.collection('logins'); - var error = false; +<<<<<<< HEAD + // Add users, and login through callbacks users.insertOne( user_data, function (err) { if (err) { callbackUser(false, true, "Error : User has not been added."); } - else { + else {// user insert successfull logins.insertOne( login_data, function (err) { if (err) { callbackUser(false, true, "Error : User has not been added."); } - else { + else {// login insert successfull callbackUser(true, false, "User has been added."); } }); @@ -150,6 +151,7 @@ exports.add_user = function (fields, callbackUser) { }); db.close(); + }) .catch(function (err) { callbackUser(false, true, "Unable to connect."); diff --git a/routes/index.js b/routes/index.js index f44b175..b6db0ca 100644 --- a/routes/index.js +++ b/routes/index.js @@ -211,7 +211,6 @@ function toProperCase(string) { return string.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); } - /* Takes an input string delimited by commas, will split by comma and trim white * spaces. Consider callback. */ |
