Created
January 3, 2017 00:38
-
-
Save trepidity/30ec12ad9c2105cc4ddfd62408896588 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as types from './actionTypes'; | |
| import songApi from '../api/songApi'; | |
| export function loadSongsSuccess(songs) { | |
| return {type: 'LOAD_SONGS_SUCCESS', songs}; | |
| } | |
| export function loadSongs() { | |
| return function(dispatch) { | |
| return songApi.getAllSongs().then(songs => { | |
| dispatch(loadSongsSuccess(songs)); | |
| }).catch(error => { | |
| throw(error); | |
| }); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment