apollographql / fullstack-tutorial

🚀 The Apollo platform tutorial app

Home Page:https://www.apollographql.com/docs/tutorial/introduction.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Me Resolver on final is misleading

davicatunda opened this issue · comments

This is the resolver for me on final

me: async (_, __, { dataSources }) =>
      dataSources.userAPI.findOrCreateUser(),

However it could (and probably should) be

me: async (_, __, context) => context.user

which is the logged in user authenticated by the authorization headers.

you might be right. However, I do want to point out that the UserAPI.findOrCreateUser method, checks for a user on the context when it is called without the email argument. Not sure one solution is better than the other.