build: 1.3.5-beta38
This commit is contained in:
1 parent
024a336082
commit
a318d8dcb7
1 file changed
+3
-2
@@ -9,13 +9,14 @@ class BaseAction<PayloadType, ReturnDataType> {
|
||||
private validate: any = undefined;
|
||||
PayloadSchema: any = undefined;
|
||||
protected async check(payload: PayloadType): Promise<BaseCheckResult> {
|
||||
if (this.PayloadSchema) {
|
||||
this.validate = new Ajv().compile(this.PayloadSchema);
|
||||
}
|
||||
if (this.validate && !this.validate(payload)) {
|
||||
return {
|
||||
valid: false,
|
||||
message: this.validate.errors?.map((e: { message: any; }) => e.message).join(',') as string
|
||||
}
|
||||
} else if (this.PayloadSchema) {
|
||||
this.validate = new Ajv().compile(this.PayloadSchema);
|
||||
}
|
||||
return {
|
||||
valid: true
|
||||
|
||||
Reference in new issue
Block a user