1.0.4 • Published 6 years ago

redux-api-utility-library v1.0.4

Weekly downloads
9
License
ISC
Repository
github
Last release
6 years ago

Redux API Utility Library (RAUL)

Build Status codecov

Redux API Utility Library (RAUL) is a library of higher order reducers, an API middleware, TypeScript data types, and other utility functions to make building a Redux Application involving asynchronous calls to RESTful APIs more simple.

Install

npm i --save redux-api-utility-library

Higher Order Reducers

import { createRequestReducer } from 'redux-api-utility-library/dist/reducers'

const users = createRequestReducer('users')

Now there is a reducer created fully equipped to deal with all the standard actions dispatched by the apiMiddleware.

Middleware

import { apiMiddleware } from 'redux-api-utility-library/dist/middleware'

const store = createStore(
  users: createRequestReducer('users'),
  {},
  applyMiddleware(apiMiddleware),
)

Action creators

import { createRequestAction } from 'redux-api-utility-library/dist/actions'

const action = createRequestAction('users', {
  method: 'GET',
  url: '/users',
  baseURL: 'https://jsonplaceholder.typicode.com',
})

this action when dispatched get handled by the apiMiddleware makes the network requests equivalent to the keys passed in as the second argument.

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago