react-alert-message
Version:
alert project message
49 lines (43 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var initialState = {
open: false,
typeMessage: 'DEFAULT', // DEFAULT, ERROR, WARNING, SUCCESS, SYSTEM_ERROR, LOADING
message: {
th: '',
en: '',
technical: ''
}, // class ApplicationError
processInstance: '',
trxId: ''
};
var reactAlertMessageReducer = function reactAlertMessageReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
var action = arguments[1];
switch (action.type) {
case 'OPEN_REACT_ALERT_MESSAGE':
{
return _extends({}, state, {
open: true,
typeMessage: action.typeMessage,
message: action.message,
processInstance: action.processInstance,
trxId: action.trxId
});
}
case 'CLOSE_REACT_ALERT_MESSAGE':
{
return _extends({}, state, {
open: false
});
}
default:
{
return state;
}
}
};
exports.default = reactAlertMessageReducer;