component/component.js
// Add custom validation beyond what can be done from the config API schema
Add custom validation beyond what can be done from the config API schema
Add custom validation beyond what can be done from the config API schema
validate() {
    this._super();
    var errors = get(this, 'errors')||[];
    if ( !get(this, 'model.name') ) {
      errors.push('Name is required');
    }
    if ( !get(this, 'model.%%DRIVERNAME%%Config.token') ) {
      errors.push('Token is required');
    }
    if ( get(errors, 'length') ) {
      set(this, 'errors', errors);
      return false;
    } else {
      set(this, 'errors', null);
      return true;
    }
  }
validate ( ) { this . _super ( ) ; var errors = get ( this , 'errors' ) || [ ] ; if ( ! get ( this , 'model.name' ) ) { errors . push ( 'Name is required' ) ; } if ( ! get ( this , 'model.%%DRIVERNAME%%Config.token' ) ) { errors . push ( 'Token is required' ) ; } if ( get ( errors , 'length' ) ) { set ( this , 'errors' , errors ) ; return false ; } else { set ( this , 'errors' , null ) ; return true ; } }
Add custom validation beyond what can be done from the config API schema
Add custom validation beyond what can be done from the config API schema
// Get generic API validation errors // Set the array of errors for display, // and return true if saving should continue.