react-redux-alerts
Advanced tools
Comparing version 1.3.10 to 1.3.11
@@ -65,7 +65,8 @@ 'use strict'; | ||
var mapStateToProps = function mapStateToProps(state) { | ||
isVisible: state.alerts[alertName]; | ||
function mapStateToProps(state) { | ||
return { isVisible: state.alerts ? state.alerts[alertName] : false }; | ||
}; | ||
var mapDispatchToProps = function mapDispatchToProps(dispatch) { | ||
actions: (0, _redux.bindActionCreators)(alertActions, dispatch); | ||
function mapDispatchToProps(dispatch) { | ||
return { actions: (0, _redux.bindActionCreators)(alertActions, dispatch) }; | ||
}; | ||
@@ -72,0 +73,0 @@ return (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(AlertContainer); |
@@ -38,2 +38,3 @@ 'use strict'; | ||
if (state === undefined) return state; | ||
if (type === alertTypes.INITIALIZE_ALERT) { | ||
@@ -49,2 +50,3 @@ return _extends({}, state, _defineProperty({}, alertName, false)); | ||
if (state[alertName] === undefined) return state; | ||
if (type === alertTypes.DESTROY_ALERT) { | ||
@@ -56,5 +58,4 @@ return Object.keys(state).reduce(function (acc, alert) { | ||
} | ||
if (state[alertName] === undefined) return state; | ||
return Object.assign({}, state, _defineProperty({}, alertName, reducer(state[alertName], action))); | ||
}; | ||
exports.default = alertReducer; |
{ | ||
"name": "react-redux-alerts", | ||
"version": "1.3.10", | ||
"version": "1.3.11", | ||
"description": "A lightweight library for creating keyed alerts in a Redux app", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -0,0 +0,0 @@ import * as alertConstants from './constants'; |
@@ -25,7 +25,13 @@ import React, { Component } from 'react'; | ||
const mapStateToProps = state => { isVisible: state.alerts[alertName] }; | ||
const mapDispatchToProps = dispatch => { actions: bindActionCreators(alertActions, dispatch) }; | ||
function mapStateToProps (state) { | ||
return { isVisible: state.alerts ? state.alerts[alertName] : false }; | ||
}; | ||
function mapDispatchToProps (dispatch) { | ||
return { actions: bindActionCreators(alertActions, dispatch) }; | ||
}; | ||
return connect(mapStateToProps, mapDispatchToProps)(AlertContainer); | ||
}; | ||
export default createAlert; |
@@ -0,0 +0,0 @@ export const INITIALIZE_ALERT = 'redux-alerts/INITIALIZE_ALERT'; |
@@ -0,0 +0,0 @@ import actions from './actions'; |
@@ -22,2 +22,3 @@ import * as alertTypes from './constants'; | ||
const {type, alertName } = action; | ||
if (state === undefined) return state; | ||
if (type === alertTypes.INITIALIZE_ALERT) { | ||
@@ -36,3 +37,4 @@ return { | ||
} | ||
if (state[alertName] === undefined) return state; | ||
if (type === alertTypes.DESTROY_ALERT) { | ||
@@ -45,3 +47,2 @@ return Object.keys(state).reduce((acc, alert) => { | ||
} | ||
if (state[alertName] === undefined) return state; | ||
return Object.assign({}, state, { | ||
@@ -48,0 +49,0 @@ [alertName]: reducer(state[alertName], action) |
@@ -0,0 +0,0 @@ import * as types from '../src/constants'; |
@@ -0,0 +0,0 @@ import reducer from '../src/reducer'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
407
17979