fix: action merge params (#1321)
Co-authored-by: Chareice <chareice@live.com>
This commit is contained in:
parent
d317fa056a
commit
43db2b641b
@ -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;
|
Loading…
Reference in New Issue
Block a user