Guest User

Untitled

a guest
Dec 12th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. const setPainting = painting => {
  2. return {
  3. type: 'GET_PAINTING_SUCCESS',
  4. painting
  5. }
  6. }
  7.  
  8. ...
  9.  
  10. export const fetchRandomPainting = () => {
  11. return dispatch => {
  12. return fetch(`api/random`)
  13. .then(res => res.json())
  14. .then(painting => dispatch(setPainting(painting)))
  15. .catch(error => console.log(error));
  16. }
  17. }
Add Comment
Please, Sign In to add comment