Skip to content

Commit

Permalink
commented out confusing log on route
Browse files Browse the repository at this point in the history
  • Loading branch information
wsputnam committed Jan 12, 2018
1 parent 5f9b2bb commit 995573f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const checkForUser = function (facebookId) {
return pool.query('SELECT * FROM users WHERE user.fb_id = $1', [facebookId]);
};
const insertNewFbUser = function (newUser) {
return pool.query('INSERT INTO users (fb_id, fb_name, prof_pic) VALUES ($1, $2)', [newUser.id, newUser.displayName, newUser.photo]);
return pool.query('INSERT INTO users (fb_id, fb_name, prof_pic) VALUES ($1, $2, $3)', [newUser.id, newUser.displayName, newUser.photo]);
}
const getUserProfile = function (userId) {
return pool.query('SELECT users.user_id, users.name, users.prof_pic, users.description FROM users \
Expand Down
10 changes: 5 additions & 5 deletions server/LogInServerModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ app.use(express.static(__dirname + '/../client/dist'));

//routes here

app.get('/logon', function (req, res) {
console.log('request', req.body.params)
res.json(req.body.params);
});
// app.get('/logon', function (req, res) {
// console.log('request', req.body.params)
// res.json(req.body.params);
// });

app.get('/login',
app.get('/login/facebook',

// will keep this in case we need to track request params later
// function (req, res) {
Expand Down
18 changes: 18 additions & 0 deletions server/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,25 @@ module.exports = {
console.log('getUsersFollowing had an error', err);
});
},
fbLogin: function(req, res) {
db.checkForUser(res.body.id)
.then((results) => {
let user = results.rows;
if (user.length === 0) {
let newUser = {
"id": res.body.id,
"displayName": res.body.displayName,
"photo": res.body.photos[0].value
}
db.insertNewFbUser(newUser)
.then(res.sendStatus(201))
.catch((err) => {
console.log('insert new fb user had an error', err);
})
}
})

},
usersFollowers: function(req, res) {
db.getUsersFollowers(1) //CURRENTLY HARD CODED USER ID, change to req.body
.then((results) => {
Expand Down

0 comments on commit 995573f

Please sign in to comment.