# quiqup-redux-network

> Middleware used to handle network request in redux

Latest version **1.0.0-web734.1** (published 2017-05-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install quiqup-redux-network
pnpm add quiqup-redux-network
yarn add quiqup-redux-network
bun add quiqup-redux-network
```

## 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.0.0-web734.1 |
| Published | 2017-05-05 |
| First published | 2017-05-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Quiqup |
| Maintainers | andreaswc |
| Keywords | quiqup, redux, network |

## Links

- npm: https://www.npmjs.com/package/quiqup-redux-network
- Repository: git@gitlab.quiqup.com:frontend/quiqup-redux-network
- npm.io page: https://npm.io/package/quiqup-redux-network

## Recent versions

- 1.0.0-web734.1 (latest) — 2017-05-05

## README

# QuiupReduxNetwork

Package that provides middlewares that handle network actions

## Network Error Middleware

Middleware that dispatches actions when some network call fails

### Usage

```javascript
import { createStore, applyMiddleware, compose } from 'redux'
import rootReducer from './reducers'
import { networkErrorMiddleware } from '@quiqupltd/quiqup-redux-network'

export default function configureStore(preloadedState) {
  return createStore(rootReducer, preloadedState, compose(
    applyMiddleware(networkErrorMiddleware),
  ))
}
```

### What it does
Middleware used to handle network request errors.
Dispatches action type NETWORK_ERROR or handles action and continues to the next middleware

##### Example
  ```javascript
    let myAction = {
      payload: 'test',
      type: 'getStore'
    }

    let next = (action) => {
      return (action) => {
        return action
      }
    }

    networkErrorMiddleware(action) {
      // on fail
      expect(next(myAction).type).toBe('NETWORK_ERROR')
      // on success
      expect(next(myAction).payload).toBe('test')
    }
  ```


### Contributing

Getting the project ready:
```sh
git clone git@gitlab.quiqup.com:frontend/quiqup-redux-network.git
cd quiqup-redux-network
npm install
```

Running tests
```sh
npm run test:watch
```

Build bundle
```sh
npm run build:watch
```

### Working with another project

To develop with another application, you can use `npm link` to connect your project to quiqup-redux-network while developing
```sh
cd quiqup-redux-network
npm link
cd /project-using-quiqup-redux-network
npm link @quiqup/quiqup-redux-network
```

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