diff --git a/smart-hut/src/components/modalform.js b/smart-hut/src/components/modalform.js index 1e29897..8ced527 100644 --- a/smart-hut/src/components/modalform.js +++ b/smart-hut/src/components/modalform.js @@ -9,8 +9,8 @@ export default class ModalWindow extends Component { this.state = { id : "", selectedIcon: "", - name: "", - img: "", + name: this.props.type === 'new' ? '' : this.props.idRoom.name, + img: this.props.type === 'new' ? '' : this.props.idRoom.images, openModal: false } @@ -31,7 +31,7 @@ export default class ModalWindow extends Component { modifyRoomModal = (e) => { let data = { "icon" : this.state.selectedIcon === "" ? this.props.idRoom.icon : this.state.selectedIcon , - "name" : this.state.name === ""? this.props.idRoom.name : this.state.name, + "name" : this.state.name === "" ? this.props.idRoom.name : this.state.name, "image" : this.state.img } this.props.updateRoom(data); @@ -48,6 +48,7 @@ export default class ModalWindow extends Component { let nam = event.target.name; let val = event.target.value; this.setState({[nam]: val}); + console.log(this.state); } closeModal = (e) => { @@ -108,12 +109,12 @@ export default class ModalWindow extends Component {

Insert the name of the room:

+ value={this.state.name}/>

Insert an image of the room:

+ value={this.state.img}/>