@@ -65,14 +65,14 @@ const AuthenticationRequiredError = createError('AuthenticationRequiredError', {
65
65
66
66
export const isAuthenticatedResolver = baseResolver .createResolver (
67
67
// Extract the user from context (undefined if non-existent)
68
- (root , args , { user }) => {
68
+ (root , args , { user }, info ) => {
69
69
if (! user) throw new AuthenticationRequiredError ();
70
70
}
71
71
);
72
72
73
73
export const isAdminResolver = isAuthenticatedResolver .createResolver (
74
74
// Extract the user and make sure they are an admin
75
- (root , args , { user }) => {
75
+ (root , args , { user }, info ) => {
76
76
/*
77
77
If thrown, this error will bubble up to baseResolver's
78
78
error callback (if present). If unhandled, the error is returned to
@@ -100,7 +100,7 @@ const NotYourUserError = createError('NotYourUserError', {
100
100
});
101
101
102
102
const updateMyProfile = isAuthenticatedResolver .createResolver (
103
- (root , { input }, { user, models: { UserModel } }) => {
103
+ (root , { input }, { user, models: { UserModel } }, info ) => {
104
104
/*
105
105
If thrown, this error will bubble up to isAuthenticatedResolver's error callback
106
106
(if present) and then to baseResolver's error callback. If unhandled, the error
@@ -128,7 +128,7 @@ const ExposedError = createError('ExposedError', {
128
128
});
129
129
130
130
const banUser = isAdminResolver .createResolver (
131
- (root , { input }, { models: { UserModel } }) => UserModel .ban (input),
131
+ (root , { input }, { models: { UserModel } }, info ) => UserModel .ban (input),
132
132
(root , args , context , error ) => {
133
133
/*
134
134
For admin users, let's tell the user what actually broke
@@ -175,7 +175,7 @@ import { and, or } from 'apollo-resolvers';
175
175
import isFooResolver from ' ./foo' ;
176
176
import isBarResolver from ' ./bar' ;
177
177
178
- const banResolver = (root , { input }, { models: { UserModel } })=> UserModel .ban (input);
178
+ const banResolver = (root , { input }, { models: { UserModel } }, info )=> UserModel .ban (input);
179
179
180
180
// Will execute banResolver if either isFooResolver or isBarResolver successfully resolve
181
181
// If none of the resolvers succeed, the error from the last conditional resolver will
0 commit comments