Skip to content

Commit

Permalink
fix: duplicate afterRead collection hook call on loginOperation (#9664)
Browse files Browse the repository at this point in the history
Hi there,

i noticed that the `afterRead` hook is triggered twice on
`loginOperation`.

This just removes the duplicated code.

-Tobi
  • Loading branch information
1b0t authored Dec 2, 2024
1 parent edc04ae commit c5fe021
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions packages/payload/src/auth/operations/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,6 @@ export const loginOperation = async <TSlug extends CollectionSlug>(
})) || user
}, Promise.resolve())

// /////////////////////////////////////
// afterRead - Collection
// /////////////////////////////////////

await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {
await priorHook

user =
(await hook({
collection: args.collection?.config,
context: req.context,
doc: user,
req,
})) || user
}, Promise.resolve())

let result: { user: DataFromCollectionSlug<TSlug> } & Result = {
exp,
token,
Expand Down

0 comments on commit c5fe021

Please sign in to comment.