Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, {Component} from 'react';
- import {connect} from 'react-redux';
- import {fetchUsersSuccess, fetchUsers, fetchUsersFailure, deleteUser, deleteUserSuccess, deleteUserFailure, reset, showModal} from "../actions/userActions";
- import UserList from "../components/UserList";
- const mapStateToProps = (state) => {
- return {
- userList: state.user.userList
- };
- }
- const mapDispatchToProps = (dispatch) => {
- return {
- fetchUsers: () => {console.log("FetchUsers1: "+new Date().getTime());
- dispatch(fetchUsers()).then((response) => {
- !response.error ? dispatch(fetchUsersSuccess(response.payload.data)) : dispatch(fetchUsersFailure(response.payload.data));
- });
- },
- refreshUsers: (id) => {
- dispatch(reset());
- dispatch(fetchUsers()).then((response) => {
- !response.error ? dispatch(fetchUsersSuccess(response.payload.data)) : dispatch(fetchUsersFailure(response.payload.data));
- });
- }
- }
- }
- export default connect(mapStateToProps, mapDispatchToProps)(UserList);
Advertisement
Add Comment
Please, Sign In to add comment