Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import axios from 'axios';
- export const FETCH_USERS = 'FETCH_USERS';
- export const FETCH_USERS_SUCCESS = 'FETCH_USERS_SUCCESS';
- export const FETCH_USERS_FAILURE = 'FETCH_USERS_FAILURE';
- export const RESET = 'RESET';
- export function fetchUsers() {
- const request = axios({
- method: 'get',
- url: "http://localhost:8000/api/users",
- headers: []
- });
- return {
- type: FETCH_USERS,
- payload: request
- };
- }
- export function fetchUsersSuccess(users) {
- return {
- type: FETCH_USERS_SUCCESS,
- payload: users
- }
- }
- export function fetchUsersFailure(error) {
- return {
- type: FETCH_USERS_FAILURE,
- payload: error
- }
- }
- export function reset() {
- return {
- type: RESET,
- payload: true
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment