Skip to content

Commit 75b3dcc

Browse files
author
Corjen Moll
committed
Update readme with 4th info parameter
1 parent 118ef92 commit 75b3dcc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ const AuthenticationRequiredError = createError('AuthenticationRequiredError', {
6565

6666
export 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

7373
export 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

102102
const 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

130130
const 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';
175175
import isFooResolver from './foo';
176176
import 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

Comments
 (0)