New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@entando/messages

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entando/messages

messages redux states for errors and toasts

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

messages

Redux states used to manage messages

Installation instructions

run npm i @entando/messages

Inside your main reducer add the messages reducer:

import { combineReducers } from 'redux';
import { messages } from '@entando/messages';

export default combineReducers({
  messages,
});

The resulting state will be:

{
  messages: {
    errors: [],
    toasts: {},
  }
}

Errors

The errors state only exposes basic actions and selectors

addErrors(errors)

addErrors expects an array of errors that will be set.

clearErrors()

clearErrors removes all the errors currently stored in the state.

getErrors(state)

The getErrors selector returns the full array of currently stored errors.

Toasts

The toasts state exports actions, selectors and a list of constants representing the toast types.

addToast(message, type)

addToast needs a message string and a type. It is highly recommend to use the types exported by the package, although it is possible to use custom ones.

removeToast(id)

removeToast removes from the state any toast with the matching ID. whenever a toast is added to the state a unique ID is assigned to it.

getToasts(state)

The getToasts selector returns the object containing all the existing toasts, with each message assigned to a unique ID.

{
  'f64f2940-fae4-11e7-8c5f-ef356f279131': {
    message: 'toast message',
    type: TOAST_ERROR,
  },
}

Types

The given types constants are exported by this package:

  • TOAST_INFO
  • TOAST_WARNING
  • TOAST_ERROR
  • TOAST_SUCCESS

Keywords

entando

FAQs

Package last updated on 02 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts