reapop-redux-axios-middleware

0.5.0 • Public • Published

reapop-redux-axios-middleware

Redux middleware to trigger reapop's notifications from axios actions.

Build Status

Overview

This module allows you to dispatch notifications from axios actions using reapop.

Installation

Fist, install redux-axios-middleware and reapop. Then:

npm i -S reapop-redux-axios-middleware

Notifications

export const saveProfile = (userId, profile) => {
  return {
    types: [SAVE_PROFILE_REQUEST, SAVE_PROFILE_SUCCESS, SAVE_PROFILE_FAILURE],
    payload: {
      request: {
        url: `/users/${userId}`,
        method: 'PUT',
        data: profile,
      },
      messages: [{
        title: 'Profile',
        message: 'The profile was saved!',
        status: 'success',
        dismissible: true,
        dismissAfter: 3000
      }, 
      {
        title: 'Profile',
        message: 'Error saving the profile.',
        status: 'error',
        dismissible: true,
        dismissAfter: 3000
      }]
    }
  };
};

Package Sidebar

Install

npm i reapop-redux-axios-middleware

Weekly Downloads

0

Version

0.5.0

License

MIT

Last publish

Collaborators

  • joelmcs6
  • albertomr86
  • jimmycodesocial