debug room socket connect dispatch
This commit is contained in:
parent
976293f099
commit
d7c0477c88
3 changed files with 26 additions and 8 deletions
19
README.md
19
README.md
|
@ -1 +1,18 @@
|
||||||
[Visit site](https://play-node-go.herokuapp.com/)
|
# Node Go
|
||||||
|
A browser application to play Go in real time.
|
||||||
|
|
||||||
|
## Development Demo
|
||||||
|
[The project in it's current state](https://play-node-go.herokuapp.com/)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- [ ] Realtime communications
|
||||||
|
- [ ] Multiple game settings
|
||||||
|
- [ ] Customizable board size
|
||||||
|
|
||||||
|
|
||||||
|
## Built with
|
||||||
|
- [Express](https://expressjs.com)
|
||||||
|
- [React](https://reactjs.org)
|
||||||
|
- [PostgreSQL](https://postgresql.org)
|
||||||
|
- [Socket.io](https://socket.io)
|
||||||
|
- [Sass](https://sass-lang.com)
|
||||||
|
|
|
@ -15,12 +15,12 @@ const launch = (nsp, dispatch) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('room_connected', (data) => {
|
socket.on('room_connected', (data) => {
|
||||||
dispatch({ type: 'ROOM', message: 'CONNECT_ROOM', body: data });
|
dispatch({ type: 'ROOMS', message: 'CONNECT_ROOM', body: data });
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('new_user', (data) => {
|
socket.on('new_user', (data) => {
|
||||||
console.log('new_user received')
|
console.log('new_user received')
|
||||||
dispatch({ type: 'ROOM', message: 'NEW_USER', body: data })
|
dispatch({ type: 'ROOMS', message: 'NEW_USER', body: data })
|
||||||
})
|
})
|
||||||
|
|
||||||
return socket;
|
return socket;
|
||||||
|
|
|
@ -25,8 +25,9 @@ export const roomsReducer = (state: state, action: action):state => {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'NEW_USER': {
|
case 'NEW_USER': {
|
||||||
console.log('hey')
|
if (!action.data) {
|
||||||
console.log(action.data)
|
return state;
|
||||||
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue