Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const setPainting = painting => {
- return {
- type: 'GET_PAINTING_SUCCESS',
- painting
- }
- }
- ...
- export const fetchRandomPainting = () => {
- return dispatch => {
- return fetch(`api/random`)
- .then(res => res.json())
- .then(painting => dispatch(setPainting(painting)))
- .catch(error => console.log(error));
- }
- }
Add Comment
Please, Sign In to add comment