react-redux-alerts
Advanced tools
Comparing version 1.5.3 to 1.5.4
@@ -33,2 +33,7 @@ 'use strict'; | ||
var defaultState = { | ||
isVisible: false, | ||
message: '' | ||
}; | ||
var createAlert = function createAlert(config) { | ||
@@ -78,4 +83,7 @@ return function (WrappedComponent) { | ||
function mapStateToProps(state) { | ||
return { isVisible: state.alerts ? state.alerts[alertName] : false }; | ||
if (!state[alertName]) return defaultState; | ||
return { | ||
isVisible: state[alertName].isVisible, | ||
message: state[alertName].message | ||
}; | ||
}; | ||
@@ -82,0 +90,0 @@ |
{ | ||
"name": "react-redux-alerts", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "A lightweight library for creating keyed alerts in a Redux app", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -6,2 +6,7 @@ import React, { Component } from 'react'; | ||
const defaultState = { | ||
isVisible: false, | ||
message: '' | ||
}; | ||
const createAlert = config => WrappedComponent => { | ||
@@ -31,4 +36,7 @@ const { alertName } = config; | ||
function mapStateToProps (state) { | ||
return { isVisible: state.alerts ? state.alerts[alertName] : false }; | ||
if (!state[alertName]) return defaultState; | ||
return { | ||
isVisible: state[alertName].isVisible, | ||
message: state[alertName].message | ||
}; | ||
}; | ||
@@ -35,0 +43,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22561
437