Skip to content

Instantly share code, notes, and snippets.

@mvbattan
Created December 11, 2017 18:02
Show Gist options
  • Save mvbattan/aac3d7197c4a1cc3447175433ccf5558 to your computer and use it in GitHub Desktop.
Save mvbattan/aac3d7197c4a1cc3447175433ccf5558 to your computer and use it in GitHub Desktop.
Create Thunk Action
import SoccerService from '../services/SoccerService';
export const actions = createTypes(completeTypes['GET_MATCHES','GET_PITCHES'], '@SOCCER');
const actionCreators = {
getMatches: () =>
createThunkAction(actions.GET_MATCHES, 'matches', SoccerService.getMatches),
getPitches: clubId =>
createThunkAction(actions.GET_PITCHES, 'pitches', SoccerService.getPitches, () => clubId)
};
export default actionCreators;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment