Guest User

Untitled

a guest
Jul 4th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import axios from 'axios';
  2.  
  3. export const FETCH_USERS = 'FETCH_USERS';
  4. export const FETCH_USERS_SUCCESS = 'FETCH_USERS_SUCCESS';
  5. export const FETCH_USERS_FAILURE = 'FETCH_USERS_FAILURE';
  6. export const RESET = 'RESET';
  7.  
  8. export function fetchUsers() {
  9.     const request = axios({
  10.         method: 'get',
  11.         url: "http://localhost:8000/api/users",
  12.         headers: []
  13.     });
  14.  
  15.     return {
  16.         type: FETCH_USERS,
  17.         payload: request
  18.     };
  19. }
  20.  
  21. export function fetchUsersSuccess(users) {
  22.     return {
  23.         type: FETCH_USERS_SUCCESS,
  24.         payload: users
  25.     }
  26. }
  27.  
  28. export function fetchUsersFailure(error) {
  29.     return {
  30.         type: FETCH_USERS_FAILURE,
  31.         payload: error
  32.     }
  33. }
  34.  
  35. export function reset() {
  36.     return {
  37.         type: RESET,
  38.         payload: true
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment