Auth0 client integration ready

This commit is contained in:
Luis Fernando Molina committed 2018-09-06 20:34:06 +02:00
1 parent 3f9423e91d
commit eca2e6deff
12 files changed
+614 -10

No files matched your search

+17 -1
View File
@@ -73,7 +73,23 @@ const RootQuery = new GraphQLObjectType({
args: {authId: {type: GraphQLString}},
resolve(parent,args) {
// Code to get data from data source.
return User.findOne({authId: args.authId});
return new Promise((resolve, reject) => {
User.findOne({authId: args.authId}, (err, user) => {
if(err) reject(err);
else{
if (user.authId === args.authId && user.authId !== undefined) {
console.log(user );
console.log(user.authId );
console.log(args.authId );
return resolve(user);
} else {
return null;
}
}
})
})
}
},
role: {