Skip to content

Instantly share code, notes, and snippets.

@tfiechowski
Last active October 28, 2018 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfiechowski/d0f9fd37264cde17510b0c31aa60bd6a to your computer and use it in GitHub Desktop.
Save tfiechowski/d0f9fd37264cde17510b0c31aa60bd6a to your computer and use it in GitHub Desktop.
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