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 = {}) {
|
mergeParams(params: ActionParams, strategies: MergeStrategies = {}) {
|
||||||
|
if (!this.params) {
|
||||||
|
this.params = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!params) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
assign(this.params, params, {
|
assign(this.params, params, {
|
||||||
filter: 'andMerge',
|
filter: 'andMerge',
|
||||||
fields: 'intersect',
|
fields: 'intersect',
|
||||||
@ -291,16 +299,18 @@ export class Action {
|
|||||||
if (typeof handler !== 'function') {
|
if (typeof handler !== 'function') {
|
||||||
throw new Error('Handler must be a function!');
|
throw new Error('Handler must be a function!');
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHandlers() {
|
getHandlers() {
|
||||||
const handers = [
|
const handlers = [
|
||||||
...this.resource.resourcer.getMiddlewares(),
|
...this.resource.resourcer.getMiddlewares(),
|
||||||
...this.getMiddlewareHandlers(),
|
...this.getMiddlewareHandlers(),
|
||||||
this.getHandler(),
|
this.getHandler(),
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
return handers;
|
|
||||||
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(context: any, next?: any) {
|
async execute(context: any, next?: any) {
|
||||||
|
Loading…
Reference in New Issue
Block a user