1
0

reducer updates

This commit is contained in:
2020-05-13 12:54:28 -04:00
parent e0bcb1fac0
commit b5e0c808e6

View File

@@ -32,16 +32,19 @@ export const reducer = createReducer(
]
})),
on(GameActions.playMatchFailure, (state, action) => ({
gameStatus: 'post',
gameStatus: 'pre',
gameHistory: [
...state.gameHistory,
action.error
action.game
]
})),
on(GameActions.resetMatch, (state, action) => ({
...state,
gameStatus: 'pre'
}))
);
export const getHasGameHistory = (state: State) => state.gameHistory.length > 0;
export const getHasGameHistory = (state: State) => state.gameHistory.length > 0;
export const getGameStatus = (state: State) => state.gameStatus;
export const getRecentMatchHistory = (state: State) => state.gameHistory.slice(-1).pop();