mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
add ADD and put in a validator as cmd can't be empty
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Schema, { InternalRuleItem } from 'async-validator';
|
||||
import { IP_OR_HOSTNAME_VALIDATOR } from 'validators/shared';
|
||||
import { Settings } from './types';
|
||||
import { Settings, ScheduleItem } from './types';
|
||||
|
||||
export const GPIO_VALIDATOR = {
|
||||
validator(rule: InternalRuleItem, value: number, callback: (error?: string) => void) {
|
||||
@@ -84,3 +84,8 @@ export const createSettingsValidator = (settings: Settings) =>
|
||||
shower_alert_coldshot: [{ type: 'number', min: 1, max: 10, message: 'Time must be between 1 and 10 seconds' }]
|
||||
})
|
||||
});
|
||||
|
||||
export const schedulerItemValidation = (si: ScheduleItem, creating: boolean) =>
|
||||
new Schema({
|
||||
cmd: [{ required: true, message: 'Command is required' }]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user