summaryrefslogtreecommitdiff
path: root/frontend/src/redux
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/redux')
-rw-r--r--frontend/src/redux/games.js2
-rw-r--r--frontend/src/redux/players.js8
2 files changed, 8 insertions, 2 deletions
diff --git a/frontend/src/redux/games.js b/frontend/src/redux/games.js
index b5fd910e..4115323c 100644
--- a/frontend/src/redux/games.js
+++ b/frontend/src/redux/games.js
@@ -25,3 +25,5 @@ export default (state = initialState, action) => {
return state
}
}
+
+export const getAllGames = state => state.get('games')
diff --git a/frontend/src/redux/players.js b/frontend/src/redux/players.js
index 99f27d80..967d93b6 100644
--- a/frontend/src/redux/players.js
+++ b/frontend/src/redux/players.js
@@ -1,4 +1,4 @@
-import { fromJS } from 'immutable'
+import { fromJS, Map } from 'immutable'
export const types = {
SET_USERNAME: 'USER/SET_USERNAME',
@@ -20,7 +20,7 @@ export const actions = {
const initialState = fromJS({
all: {},
- current: null
+ current: ''
})
export default (state = initialState, action) => {
@@ -38,3 +38,7 @@ export default (state = initialState, action) => {
return state
}
}
+
+export const getCurrentPlayerUserName = state => state.get('players').get('current')
+export const getAllPlayers = state => state.get('players').get('all')
+export const getCurrentPlayer = (state) => getAllPlayers(state).get(getCurrentPlayerUserName(state), Map())
bgstack15