From b5e0c808e695064eaea83509e53a64c099bdad0f Mon Sep 17 00:00:00 2001 From: Andrew Kemp Date: Wed, 13 May 2020 12:54:28 -0400 Subject: [PATCH] reducer updates --- src/app/store/game/game.reducer.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/store/game/game.reducer.ts b/src/app/store/game/game.reducer.ts index 67378cb..9df3e14 100644 --- a/src/app/store/game/game.reducer.ts +++ b/src/app/store/game/game.reducer.ts @@ -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; \ No newline at end of file +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(); \ No newline at end of file