# redux-await-middleware

> Await(Promise) middleware for Redux

Latest version **1.3.0** (published 2016-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-await-middleware
pnpm add redux-await-middleware
yarn add redux-await-middleware
bun add redux-await-middleware
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2016-02-03 |
| First published | 2015-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Yeongjin Lee |
| Maintainers | zenato |
| Keywords | redux, await, promise, middleware, redux-middleware, flux, flux-standard-action |

## Links

- npm: https://www.npmjs.com/package/redux-await-middleware
- Repository: https://github.com/zenato/redux-await-middleware
- Homepage: https://github.com/zenato/redux-await-middleware#readme
- Issues: https://github.com/zenato/redux-await-middleware/issues
- npm.io page: https://npm.io/package/redux-await-middleware

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2016-02-03
- 1.2.0 — 2016-01-22
- 1.1.0 — 2015-12-21
- 1.0.2 — 2015-12-18
- 1.0.1 — 2015-12-18
- 1.0.0 — 2015-12-18

## README

Redux Await(Promise) Middleware
===============================

Await(Promise) [middleware](http://rackt.github.io/redux/docs/advanced/Middleware.html) for Redux.

Await middleware supprorts [FSA](https://github.com/acdlite/flux-standard-action) actions.


## Installation

```
npm install --save redux-await-middleware
```

Then, to enable Redux Await(Promise) Middleware, use [`applyMiddleware()`](http://rackt.github.io/redux/docs/api/applyMiddleware.html):

```js
import { applyMiddleware, createStore } from 'redux';
import awaitMiddleware from 'redux-await-middleware';
import reducers from './reducers/index';

const createStoreWithMiddleware = applyMiddleware(awaitMiddleware)(createStore);
const store = createStoreWithMiddleware(reducers);
```

## Usage

Create plain action function:

```js
function getData(params) {
  return {
    type: 'GET_DATA',
    payload: request.get('http://some_api'), // return Promise.
  }
}
```

or use [`redux-actions`](https://github.com/acdlite/redux-actions):

```js
var getData = createAction('GET_DATA', request.get('http://some_api'));
```

Then, use resolved data on Reducer:

```js
function someReducer(state = defaultState, action) {
  switch (action.type) {
    case 'GET_DATA':
      // can access result using payload property.
      return state.concat(action.payload);
    default:
      return state;
  }
}
```

## License

MIT

---
_Source: https://npm.io/package/redux-await-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
