Skip to content

Commit 18848ab

Browse files
committed
make github login more consistent
1 parent 4c755b8 commit 18848ab

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

netlify/functions/github.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,16 @@ module.exports = extrovert.toNetlifyFunction(async function github(params) {
3232
const { id: githubUserId, notification_email: email, avatar_url: picture, name, login: githubUsername } = userData;
3333

3434
const $set = {
35-
githubUserId
36-
};
37-
const $setOnInsert = {
35+
githubUserId,
3836
email,
3937
picture,
40-
name,
41-
githubUsername
38+
name
4239
};
4340

4441
const user = await User.findOneAndUpdate(
4542
{ githubUsername },
4643
{
47-
$set,
48-
$setOnInsert
44+
$set
4945
},
5046
{ upsert: true, returnDocument: 'after' }
5147
);

0 commit comments

Comments
 (0)