Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import searchService from '../../../services/search/searchService';
  2. import { actionTypes } from '../RepoSearchConstants';
  3.  
  4. export const fetchRepos = () => async (dispatch) => {
  5. let error = '';
  6. dispatch({
  7. type: actionTypes.REQUEST_START,
  8. });
  9. try {
  10. const { items } = await searchService.repoSearch();
  11. dispatch({
  12. type: actionTypes.UPDATE_RESULTS,
  13. items,
  14. });
  15. }
  16. catch ({ message }) {
  17. error = message;
  18. }
  19. dispatch({
  20. type: actionTypes.REQUEST_COMPLETE,
  21. error,
  22. });
  23. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement