Last active
October 28, 2018 23:44
-
-
Save tfiechowski/d0f9fd37264cde17510b0c31aa60bd6a 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 api from './api'; | |
export const ADD_PHOTOS = 'Photos/ADD_PHOTOS'; | |
export function addPhotos(photos) { | |
return { | |
type: ADD_PHOTOS, | |
payload: photos, | |
}; | |
} | |
export function fetchPhotos() { | |
return async function(dispatch) { | |
const { data: photos } = await api.fetchPhotos(); | |
dispatch(addPhotos(photos)); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment