Open tasoskakour opened 3 years ago
withMiddlewares
is method of Resolver
, you can chaining withMiddlewares
with your resolver resolve: userGetMe.withMiddlewares([myMiddleware])
if userGetMe
is instance of Resolver
.
if you use object in addFields
= type of ObjectTypeComposerFieldConfigAsObjectDefinition
Take a look at the code blocks below.
In the first code block, the
myMiddleware
never executes. The reason I added thewithMiddlewares
property inside that object is because it's part of theResolver.d.ts
file so I assumed that this is the correct place to add middlewares for a custom resolver and technically this should have worked.In the second code block the
myMiddeware
executes correctly.First code block (middleware does not fire)
Second code block (middleware fires OK)