fix: pass result of previous hook into next hook

This commit is contained in:
Richard van Heuven van Staereling
2023-03-02 17:05:25 +01:00
parent cb005d58eb
commit c661ac2e8a

View File

@@ -233,7 +233,7 @@ async function find<T extends TypeWithID & Record<string, unknown>>(
await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {
await priorHook;
docRef = await hook({ req, query, doc, findMany: true }) || doc;
docRef = await hook({ req, query, doc: docRef, findMany: true }) || doc;
}, Promise.resolve());
return docRef;