fix: action merge params (#1321)

Co-authored-by: Chareice <chareice@live.com>
This commit is contained in:
chenos 2023-01-03 13:26:50 +08:00 committed by GitHub
parent d317fa056a
commit 43db2b641b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {