1.0.0 • Published 6 years ago

hake-redux v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

hake-redux Build Status

A promise middleware for redux, based on https://github.com/lelandrichardson/redux-pack

Install

$ npm install --save hake-redux

# or

$ yarn add hake-redux

Usage

import { createStore, applyMiddleware } from 'redux'
import hakeReduxMiddleware from 'hake-redux'
import rootReducer from './reducer'
// axios is a xhr lib just like fetch.
import axios from 'axios'
// your client
const client = axios.create()
// store
const store = createStore(
  rootReducer,
  applyMiddleware(hakeReduxMiddleware(client))
)

API

The difference between redux-pack and hake-redux is :

// actions.js
export function loadFoo(id) {
  return {
	type: LOAD_FOO,
	// redux-pack way
	// promise: Api.getFoo(id),
	// hake-redux doing.
	promise: client => client.get('/path/to/foo')
	meta: {
		onSuccess: (response) => logSuccess(response)
	},
  };
}

Redux-Pack documentation

License

MIT © bang lelandrichardson

1.0.0

6 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago