Add validation to preset's precondition
This commit is contained in:
1 parent
1128e1ce11
commit
c74f0e9c8f
1 file changed
+10
@@ -53,6 +53,16 @@ function putActionHandler(action, _object, isNew): Promise<ValidationErrors> {
|
|||||||
|
|
||||||
if (Object.keys(errors).length) return void resolve(errors);
|
if (Object.keys(errors).length) return void resolve(errors);
|
||||||
|
|
||||||
|
if (object.precondition) {
|
||||||
|
try {
|
||||||
|
object.precondition = stringify(memoizedParse(object.precondition));
|
||||||
|
} catch (err) {
|
||||||
|
return void resolve({
|
||||||
|
precondition: "Precondition must be valid expression"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
store
|
store
|
||||||
.resourceExists("presets", id)
|
.resourceExists("presets", id)
|
||||||
.then(exists => {
|
.then(exists => {
|
||||||
|
|||||||
Reference in new issue
Block a user