# @gggdomi/rrh-alerts

> Plugin for RRH to display notifications when requests resolve.

Latest version **0.1.0** (published 2019-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gggdomi/rrh-alerts
pnpm add @gggdomi/rrh-alerts
yarn add @gggdomi/rrh-alerts
bun add @gggdomi/rrh-alerts
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-01-28 |
| First published | 2019-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Guillaume Dominici |
| Maintainers | gggdomi |
| Keywords | rrh, rrh plugin, rrh alert, notifications, alerts, redux alerts, redux notifications |

## Links

- npm: https://www.npmjs.com/package/@gggdomi/rrh-alerts
- Repository: https://github.com/gggdomi/rrh-alerts
- npm.io page: https://npm.io/package/@gggdomi/rrh-alerts

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2019-01-28

## README

Plugin for [RRH](https://github.com/gggdomi/rrh) to display notifications when requests resolve.

## Installation

### Pre-requisites

- [RRH](https://github.com/gggdomi/rrh) need to be set up
- [react-toastify](https://github.com/fkhadra/react-toastify) is a peer dependency and `ToastContainer` component need to be added to your app (see https://github.com/fkhadra/react-toastify#one-component-to-rule-them-all)

`yarn add @gggdomi/rrh-alerts`

### Add rrh-alerts sagas to the app

```js
// index.js
import rrhAlertsSagas from '@gggdomi/rrh-alerts/src/sagas'

// configure saga middleware...

rrhAlertsSagas.map(sagaMiddleware.run)
```

## Usage

```js
import rrh from '@gggdomi/rrh'

export const addComment = rrh.new('ADD_COMMENT', '/comment/add/', {
  method: 'POST',
  // if not null, will display a success notification (default: null)
  successAlertText: "Comment added!",
  
  // if false won't display notification on errors (default: true)
  displayErrorAlert: false, 
  
  // if not null, will replace error message (default: null)
  failAlertText: "Could not add comment :-(", 
})
```

Then dispatch `addComment.Start()` 

## Configuration

### Global

```js
import rrhAlerts from '@gggdomi/rrh-alerts'

// set to true to automatically display a notification if a request fails (for all routes) (default: true)
rrhAlerts.displayErrorAlerts = false
```

---
_Source: https://npm.io/package/@gggdomi/rrh-alerts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
