fullstack-tutorial icon indicating copy to clipboard operation
fullstack-tutorial copied to clipboard

Me Resolver on final is misleading

Open davicatunda opened this issue 5 years ago • 1 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.

davicatunda avatar Apr 30 '20 02:04 davicatunda

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.

dylan-cm avatar Apr 26 '21 22:04 dylan-cm