diff --git a/packages/core/resourcer/src/action.ts b/packages/core/resourcer/src/action.ts index f5c131c9a..c41ad889e 100644 --- a/packages/core/resourcer/src/action.ts +++ b/packages/core/resourcer/src/action.ts @@ -246,6 +246,14 @@ export class Action { } mergeParams(params: ActionParams, strategies: MergeStrategies = {}) { + if (!this.params) { + this.params = {}; + } + + if (!params) { + return; + } + assign(this.params, params, { filter: 'andMerge', fields: 'intersect', @@ -291,16 +299,18 @@ export class Action { if (typeof handler !== 'function') { throw new Error('Handler must be a function!'); } + return handler; } getHandlers() { - const handers = [ + const handlers = [ ...this.resource.resourcer.getMiddlewares(), ...this.getMiddlewareHandlers(), this.getHandler(), ].filter(Boolean); - return handers; + + return handlers; } async execute(context: any, next?: any) { @@ -325,4 +335,4 @@ export class Action { } } -export default Action; +export default Action; \ No newline at end of file