updateRoomType(){
    const req = request.patch(`/v1/roomTypes/${this.props.roomType.id}`);
    const obj = {};
    try {
      const obj = {
        name: this.state.Name,
        isEnabled: this.state.Enabled == 'true',
        bots:  Array.isArray(this.state.Bots) ?
          this.state.Bots : typeof this.state.Bots === 'string' ?
          this.state.Bots.split(',') : [],
        settings: JSON.parse(this.state.Settings),
      };
      req
        .send(obj)
        .end((error, res) => {
          if (error) {
            this.setState({ error: error.response.body.errors[0].message });
          } else {
            window.location.replace(`/rooms/types/${res.body.id}`);
          }
        });
    } catch (e) {
      this.setState({ error: e.message });
    }
  }
/**
   * Update roomType based on input fields current state
   */
Update roomType based on input fields current state
Update roomType based on input fields current state
updateRoomType(){
    const req = request.patch(`/v1/roomTypes/${this.props.roomType.id}`);
    const obj = {};
    try {
      const obj = {
        name: this.state.Name,
        isEnabled: this.state.Enabled == 'true',
        bots:  Array.isArray(this.state.Bots) ?
          this.state.Bots : typeof this.state.Bots === 'string' ?
          this.state.Bots.split(',') : [],
        settings: JSON.parse(this.state.Settings),
      };
      req
        .send(obj)
        .end((error, res) => {
          if (error) {
            this.setState({ error: error.response.body.errors[0].message });
          } else {
            window.location.replace(`/rooms/types/${res.body.id}`);
          }
        });
    } catch (e) {
      this.setState({ error: e.message });
    }
  }
updateRoomType ( ) { const req = request . patch ( ` ${ this . props . roomType . id } ` ) ; const obj = { } ; try { const obj = { name : this . state . Name , isEnabled : this . state . Enabled == 'true' , bots : Array . isArray ( this . state . Bots ) ? this . state . Bots : typeof this . state . Bots === 'string' ? this . state . Bots . split ( ',' ) : [ ] , settings : JSON . parse ( this . state . Settings ) , } ; req . send ( obj ) . end ( ( error , res ) => { if ( error ) { this . setState ( { error : error . response . body . errors [ 0 ] . message } ) ; } else { window . location . replace ( ` ${ res . body . id } ` ) ; } } ) ; } catch ( e ) { this . setState ( { error : e . message } ) ; } }
Update roomType based on input fields current state
Update roomType based on input fields current state