# fusion-plugin-rpc-redux

> Triggers Redux actions when RPC methods are called

Latest version **0.1.8** (published 2017-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install fusion-plugin-rpc-redux
pnpm add fusion-plugin-rpc-redux
yarn add fusion-plugin-rpc-redux
bun add fusion-plugin-rpc-redux
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2017-11-03 |
| First published | 2017-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 8.9.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | fusion-ci |

## Links

- npm: https://www.npmjs.com/package/fusion-plugin-rpc-redux
- Repository: https://github.com/fusionjs/fusion-plugin-rpc-redux
- Homepage: https://github.com/fusionjs/fusion-plugin-rpc-redux#readme
- Issues: https://github.com/fusionjs/fusion-plugin-rpc-redux/issues
- npm.io page: https://npm.io/package/fusion-plugin-rpc-redux

## Dependencies (1)

- [redux-reactors](https://npm.io/package/redux-reactors.md) ^1.0.3

## Recent versions

- 0.1.8 (latest) — 2017-11-03
- 0.1.5 — 2017-11-01
- 0.1.4 — 2017-11-01
- 0.1.3 — 2017-11-01
- 0.1.2 — 2017-11-01
- 0.1.1 — 2017-10-31
- 0.1.0 — 2017-10-31

## README

# fusion-plugin-rpc-redux

A collection of helper functions for working with Redux and RPC together

If using RPC from React components, you should use `fusion-plugin-rpc-redux-react` instead of this package.

---

### Installation

```sh
yarn add fusion-plugin-rpc-redux
```

---

### API

#### `createRPCActions`

```js
const {start, success, failure} = createRPCActions('foo');
start('payload') // { type: 'FOO_START', payload: 'payload' }
success('payload') // { type: 'FOO_SUCCESS', payload: 'payload' }
failure('payload') // { type: 'FOO_FAILURE', payload: 'payload' }
```

#### `createRPCReducer`

```js
const reducer = createRPCReducer('foo', {
  start: (state, action) => {}, // optional,
  success: (state, action) => {}, // optional,
  failure: (state, action) => {}, // optional,
});
```

#### `createRPCReactor`

```js
const {reactors, rpcId} = createRPCReactor('foo', {
  start: (state, action) => {}, // optional,
  success: (state, action) => {}, // optional,
  failure: (state, action) => {}, // optional,
});
```

#### `createRPCHandler`

```js
const handler = createRPCHandler({
  store, // required
  rpc, // required
  rpcId, // required
  actions: { // optional
    start: () => ({type: '', payload: ''})
    success: () => ({type: '', payload: ''})
    failure: () => ({type: '', payload: ''})
  },
  mapStateToParams: (state) => {}, // optional
  transformParams: (params) => {} // optional
});
await handler({some:'args'});
```

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