reducer updates
This commit is contained in:
@@ -32,16 +32,19 @@ export const reducer = createReducer(
|
|||||||
]
|
]
|
||||||
})),
|
})),
|
||||||
on(GameActions.playMatchFailure, (state, action) => ({
|
on(GameActions.playMatchFailure, (state, action) => ({
|
||||||
gameStatus: 'post',
|
gameStatus: 'pre',
|
||||||
gameHistory: [
|
gameHistory: [
|
||||||
...state.gameHistory,
|
...state.gameHistory,
|
||||||
action.error
|
action.game
|
||||||
]
|
]
|
||||||
})),
|
})),
|
||||||
on(GameActions.resetMatch, (state, action) => ({
|
on(GameActions.resetMatch, (state, action) => ({
|
||||||
|
...state,
|
||||||
gameStatus: 'pre'
|
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();
|
||||||
Reference in New Issue
Block a user