1.0.5 • Published 5 years ago

redux-simple-fetch v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

REDUX SIMPLE FETCH

Redux package for simple fetching data with axios

REQUIRED

GET STARTED

  1. Installation npm install redux-simple-fetch

  2. Info

    // Default initial state
    
    export const initialState = {
      result: null,
      detail: null,
      postPending: false,
      getPending: false,
      getIdPending: false,
      putPending: false,
      deletePending: false,
      getMorePending: false,
      isError: null,
      isFinished: false
    };
  3. Setup project

    // Setting reducer
    
    import { combineReducers } from 'redux';
    import reducerReduxApi from 'redux-api/reducer';
    
    const confReducerReduxApi = reducerReduxApi({
      // name reducers
      contacts: 'CONTACS'
    }, {
      // conf reducer
      propList: 'data',
      primaryItemField: 'id'
    });
    
    const appReducers = combineReducers(confReducerReduxApi);
    
    export default appReducers;
  4. Usage

    import { post, put, delete, get, get_id, get_more } from 'redux-api/action';
    ...
    ...
    ...
    dispatch(post('CONTACTS', '/api/v2/contacts'))
    .then(res => {
      // the response will be saved in redux and received here
    })
    .catch(err => {
      // error here
    });
    ...
    ...
    ...

MORE INFO

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago