From c5fe021570428ef4b3f2ecbd695a6057cfba385f Mon Sep 17 00:00:00 2001 From: Tobias Arends Date: Mon, 2 Dec 2024 20:07:15 +0100 Subject: [PATCH] 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 --- packages/payload/src/auth/operations/login.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/payload/src/auth/operations/login.ts b/packages/payload/src/auth/operations/login.ts index bbc2c28a9f3..97d2ae986b4 100644 --- a/packages/payload/src/auth/operations/login.ts +++ b/packages/payload/src/auth/operations/login.ts @@ -292,22 +292,6 @@ export const loginOperation = async ( })) || 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 } & Result = { exp, token,