59af2e756a
The reducer function in chess-game-context.jsx previously accepted two different action types MOVE_PIECE and CAPTURE_PIECE. Due to this the caller has to verify whether a move is a simple move or a capture. Since, the dispatch was called in multilpe places, it is better to keep one action type MOVE_PIECE and move the differentiating logic to the reducer. Also this commit implements a playAudioCallback which receives an action string and plays an audio accordingly. This is passed to the dispatch function and it is the responsibility of the reducer to call it with an appropriate action.