From be853a06570f774d76b777c057de32bb5bc9f91c Mon Sep 17 00:00:00 2001 From: James Date: Sat, 11 Mar 2023 00:01:59 -0800 Subject: [PATCH] chore: little cleanup --- src/plugin.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/plugin.ts b/src/plugin.ts index 88bc9151e6..3a27d599f2 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -29,36 +29,36 @@ export const payloadCloud = ...(config.admin || {}), webpack, }, - collections: (config.collections || []).map(existingCollection => { - if (existingCollection.upload) { + collections: (config.collections || []).map(collection => { + if (collection.upload) { return { - ...existingCollection, + ...collection, upload: { - ...(typeof existingCollection.upload === 'object' ? existingCollection.upload : {}), + ...(typeof collection.upload === 'object' ? collection.upload : {}), handlers: [ - ...(typeof existingCollection.upload === 'object' && - Array.isArray(existingCollection.upload.handlers) - ? existingCollection.upload.handlers + ...(typeof collection.upload === 'object' && + Array.isArray(collection.upload.handlers) + ? collection.upload.handlers : []), - getStaticHandler({ collection: existingCollection }), + getStaticHandler({ collection }), ], disableLocalStorage: true, }, hooks: { - ...(existingCollection.hooks || {}), + ...(collection.hooks || {}), beforeChange: [ - ...(existingCollection.hooks?.beforeChange || []), - getBeforeChangeHook({ collection: existingCollection }), + ...(collection.hooks?.beforeChange || []), + getBeforeChangeHook({ collection }), ], afterDelete: [ - ...(existingCollection.hooks?.afterDelete || []), - getAfterDeleteHook({ collection: existingCollection }), + ...(collection.hooks?.afterDelete || []), + getAfterDeleteHook({ collection }), ], }, } } - return existingCollection + return collection }), } }