blob: b2273fa7a77f32ae74197869dca999f35011b7ff [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001/*!
2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
15 */
16
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020017import { actionTypes, typeEnum } from './GlobalModalConstants.js';
AviZi280f8012017-06-09 02:39:56 +030018
19export default (state = null, action) => {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020020 switch (action.type) {
21 case actionTypes.GLOBAL_MODAL_SHOW:
22 return {
23 ...action.data
24 };
25 case actionTypes.GLOBAL_MODAL_ERROR:
26 return {
27 type: typeEnum.ERROR,
28 modalClassName: 'notification-modal',
29 ...action.data
30 };
31 case actionTypes.GLOBAL_MODAL_WARNING:
32 return {
33 type: typeEnum.WARNING,
34 modalClassName: 'notification-modal',
35 ...action.data
36 };
AviZi280f8012017-06-09 02:39:56 +030037
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020038 case actionTypes.GLOBAL_MODAL_SUCCESS:
39 return {
40 type: typeEnum.SUCCESS,
41 modalClassName: 'notification-modal',
42 ...action.data
43 };
AviZi280f8012017-06-09 02:39:56 +030044
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020045 case actionTypes.GLOBAL_MODAL_CLOSE:
46 return null;
47 default:
48 return state;
49 }
AviZi280f8012017-06-09 02:39:56 +030050};