diff options
author | jbion <joffrey.bion@amadeus.com> | 2019-02-22 23:09:40 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-02-22 23:09:40 +0100 |
commit | 27990fcba5a47252df617db1bc98e2276b326e7e (patch) | |
tree | 7fba886ae83379ee9d76e6540efae7b0e7ce2a25 /frontend/src/redux/actions/players.js | |
parent | Fix websocket value when no message body is received (diff) | |
download | seven-wonders-27990fcba5a47252df617db1bc98e2276b326e7e.tar.gz seven-wonders-27990fcba5a47252df617db1bc98e2276b326e7e.tar.bz2 seven-wonders-27990fcba5a47252df617db1bc98e2276b326e7e.zip |
Implement Game start
Diffstat (limited to 'frontend/src/redux/actions/players.js')
-rw-r--r-- | frontend/src/redux/actions/players.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/frontend/src/redux/actions/players.js b/frontend/src/redux/actions/players.js new file mode 100644 index 00000000..7df174c4 --- /dev/null +++ b/frontend/src/redux/actions/players.js @@ -0,0 +1,29 @@ +import { Map } from 'immutable'; +import { PlayerShape } from '../../models/players'; + +export const types = { + REQUEST_CHOOSE_USERNAME: 'USER/REQUEST_CHOOSE_USERNAME', + SET_CURRENT_PLAYER: 'USER/SET_CURRENT_PLAYER', + UPDATE_PLAYERS: 'USER/UPDATE_PLAYERS', +}; + +export type RequestChooseUsernameAction = { type: types.REQUEST_CHOOSE_USERNAME, username: string }; +export type SetCurrentPlayerAction = { type: types.SET_CURRENT_PLAYER, player: PlayerShape }; +export type UpdatePlayersAction = { type: types.UPDATE_PLAYERS, players: Map<string, PlayerShape> }; + +export type PlayerAction = RequestChooseUsernameAction | SetCurrentPlayerAction | UpdatePlayersAction; + +export const actions = { + chooseUsername: (username: string): RequestChooseUsernameAction => ({ + type: types.REQUEST_CHOOSE_USERNAME, + username, + }), + setCurrentPlayer: (player: PlayerShape): SetCurrentPlayerAction => ({ + type: types.SET_CURRENT_PLAYER, + player, + }), + updatePlayers: (players: Map<string, PlayerShape>): UpdatePlayersAction => ({ + type: types.UPDATE_PLAYERS, + players, + }), +}; |