|
@ -13,19 +13,26 @@ class App extends Component { |
|
|
super(props); |
|
|
super(props); |
|
|
|
|
|
|
|
|
this.state={ |
|
|
this.state={ |
|
|
progression: 'createRoom', |
|
|
|
|
|
roomList: [] |
|
|
|
|
|
|
|
|
progression: 'register', |
|
|
|
|
|
roomsList: [] |
|
|
} |
|
|
} |
|
|
|
|
|
this.modifyStateToCreateRoom = this.modifyStateToCreateRoom.bind(this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
componentDidMount(){ |
|
|
|
|
|
|
|
|
modifyStateToCreateRoom() { |
|
|
|
|
|
this.setState({ |
|
|
|
|
|
progression: 'createRoom' |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
stateHandler(){ |
|
|
|
|
|
socket.on('sendRooms', payload => this.setState({ |
|
|
|
|
|
progression: 'roomChoose', |
|
|
|
|
|
roomList: payload.rooms |
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
componentDidMount(){ |
|
|
|
|
|
socket.on('sendRooms', payload => { |
|
|
|
|
|
const rooms = payload.rooms; |
|
|
|
|
|
this.setState({ |
|
|
|
|
|
progression: 'roomChoose', |
|
|
|
|
|
roomsList: rooms |
|
|
|
|
|
}) |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
@ -34,9 +41,8 @@ class App extends Component { |
|
|
<NicknameInput socket = {socket}/> |
|
|
<NicknameInput socket = {socket}/> |
|
|
) |
|
|
) |
|
|
} else if(this.state.progression === 'roomChoose') { |
|
|
} else if(this.state.progression === 'roomChoose') { |
|
|
|
|
|
|
|
|
return( |
|
|
return( |
|
|
<RoomList roomArray = {this.state.roomList}/> |
|
|
|
|
|
|
|
|
<RoomList stateModifier={this.modifyStateToCreateRoom} roomArray = {this.state.roomsList}/> |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
} else if (this.state.progression === 'createRoom') { |
|
|
} else if (this.state.progression === 'createRoom') { |
|
|