@@ -65,14 +65,14 @@ const AuthenticationRequiredError = createError('AuthenticationRequiredError', {
6565
6666export const isAuthenticatedResolver = baseResolver .createResolver (
6767 // Extract the user from context (undefined if non-existent)
68- (root , args , { user }) => {
68+ (root , args , { user }, info ) => {
6969 if (! user) throw new AuthenticationRequiredError ();
7070 }
7171);
7272
7373export const isAdminResolver = isAuthenticatedResolver .createResolver (
7474 // Extract the user and make sure they are an admin
75- (root , args , { user }) => {
75+ (root , args , { user }, info ) => {
7676 /*
7777 If thrown, this error will bubble up to baseResolver's
7878 error callback (if present). If unhandled, the error is returned to
@@ -100,7 +100,7 @@ const NotYourUserError = createError('NotYourUserError', {
100100});
101101
102102const updateMyProfile = isAuthenticatedResolver .createResolver (
103- (root , { input }, { user, models: { UserModel } }) => {
103+ (root , { input }, { user, models: { UserModel } }, info ) => {
104104 /*
105105 If thrown, this error will bubble up to isAuthenticatedResolver's error callback
106106 (if present) and then to baseResolver's error callback. If unhandled, the error
@@ -128,7 +128,7 @@ const ExposedError = createError('ExposedError', {
128128});
129129
130130const banUser = isAdminResolver .createResolver (
131- (root , { input }, { models: { UserModel } }) => UserModel .ban (input),
131+ (root , { input }, { models: { UserModel } }, info ) => UserModel .ban (input),
132132 (root , args , context , error ) => {
133133 /*
134134 For admin users, let's tell the user what actually broke
@@ -175,7 +175,7 @@ import { and, or } from 'apollo-resolvers';
175175import isFooResolver from ' ./foo' ;
176176import isBarResolver from ' ./bar' ;
177177
178- const banResolver = (root , { input }, { models: { UserModel } })=> UserModel .ban (input);
178+ const banResolver = (root , { input }, { models: { UserModel } }, info )=> UserModel .ban (input);
179179
180180// Will execute banResolver if either isFooResolver or isBarResolver successfully resolve
181181// If none of the resolvers succeed, the error from the last conditional resolver will
0 commit comments