Add validation to preset's precondition

This commit is contained in:
Shweelan Samson authored and Zaid Abdulla committed 2019-06-05 00:17:36 -07:00
1 parent 1128e1ce11
commit c74f0e9c8f
1 file changed
+10
+10
View File
@@ -53,6 +53,16 @@ function putActionHandler(action, _object, isNew): Promise<ValidationErrors> {
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
.resourceExists("presets", id)
.then(exists => {