Skip to content

Instantly share code, notes, and snippets.

@lastmjs
Last active March 12, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lastmjs/f864bd52d8ad0a9545c251f076e8a016 to your computer and use it in GitHub Desktop.
Save lastmjs/f864bd52d8ad0a9545c251f076e8a016 to your computer and use it in GitHub Desktop.
export async function userOwnsDirectiveResolver(next, source, args, context) {
if (source[args.field] === await getUserId(context)) {
return await next();
}
else {
throw new Error('Not authorized');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment