fix: global afterRead and afterChange execution (#1405)

This commit is contained in:
Elliot DeNolf
2022-11-14 08:18:58 -05:00
committed by GitHub
parent 7356d8977f
commit cdaa8cc29f

View File

@@ -234,12 +234,11 @@ async function update<T extends TypeWithID = any>(args: Args): Promise<T> {
// afterRead - Global
// /////////////////////////////////////
await globalConfig.hooks.afterChange.reduce(async (priorHook, hook) => {
await globalConfig.hooks.afterRead.reduce(async (priorHook, hook) => {
await priorHook;
global = await hook({
doc: global,
previousDoc: originalDoc,
req,
}) || global;
}, Promise.resolve());