Skip to content

Commit

Permalink
docs: Update anonymous hook to support around hooks (#3379)
Browse files Browse the repository at this point in the history
  • Loading branch information
howlettt authored Jan 5, 2024
1 parent 04efd5a commit 094056a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/cookbook/authentication/anonymous.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ Next, we create a hook called `allow-anonymous` that sets `params.authentication
import { Hook, HookContext } from '@feathersjs/feathers';

export default (): Hook => {
return async (context: HookContext) => {
return async (context: HookContext, next?: NextFunction) => {
const { params } = context;

if(params.provider && !params.authentication) {
if (params.provider && !params.authentication) {
context.params = {
...params,
authentication: {
Expand All @@ -80,6 +80,10 @@ export default (): Hook => {
}
}

if (next) {
await next();
}

return context;
}
}
Expand Down

0 comments on commit 094056a

Please sign in to comment.