fix: duplicate afterRead collection hook call on loginOperation (#9664)

Hi there,

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

This just removes the duplicated code.

-Tobi
This commit is contained in:
Tobias Arends
2024-12-02 20:07:15 +01:00
committed by GitHub
parent edc04aec56
commit c5fe021570

View File

@@ -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,