@gggdomi/rrh-alerts

0.1.0 • Public • Published

Plugin for RRH to display notifications when requests resolve.

Installation

Pre-requisites

yarn add @gggdomi/rrh-alerts

Add rrh-alerts sagas to the app

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

// configure saga middleware...

rrhAlertsSagas.map(sagaMiddleware.run)

Usage

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

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

Package Sidebar

Install

npm i @gggdomi/rrh-alerts

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

4.26 kB

Total Files

7

Last publish

Collaborators

  • gggdomi