Redux Swagger Client
Swagger middleware for redux
About
This is an attempt to add asynchronous swagger api calls to redux. It works by dispatching an action that includes the field swagger
that takes a function and passes the swagger client element to that function. If the swagger spec has not yet been parsed, the action will get queued.
Installation
note: This module requires redux-thunk Github:
npm install --save github:noh4ck/redux-swagger-client
Package pending:
npm install --save redux-swagger-client
To enable Redux Swagger-client, use applyMiddleware()
:
const store = ;
Usage
{ return types: "FETCH_PETS" "FETCH_PETS_SUCCESS" "FETCH_PETS_FAILED" apipet } store
Note, it's also possible to dispatch functions:
{ return type: 'FETCH_PETS' receivedAt: Date } { return type: 'FETCH_PETS_SUCCESS' pets: jsonresultbody receivedAt: Date } { return type: 'FETCH_PETS_FAILED' pets: null error receivedAt: Date } { return actions: fetchPets_request fetchPets_success fetchPets_failure apipet } store