Skip to content

Instantly share code, notes, and snippets.

@mvbattan
Last active November 29, 2018 13:44
Show Gist options
  • Save mvbattan/5b33ca7bcdfe6c2422b366b8bc1e535b to your computer and use it in GitHub Desktop.
Save mvbattan/5b33ca7bcdfe6c2422b366b8bc1e535b to your computer and use it in GitHub Desktop.
createThunkAction with named params
import SoccerService from '../services/SoccerService';
export const actions = createTypes(completeTypes['GET_MATCHES','GET_PITCHES'], '@SOCCER');
const actionCreators = {
getMatches: () => createThunkAction({
type: actions.GET_MATCHES,
target: 'matches',
service: SoccerService.getMatches
}),
getPitches: clubId => createThunkAction({
type: actions.GET_PITCHES,
target: 'pitches',
service: SoccerService.getPitches,
payload: clubId
})
};
export default actionCreators;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment