blob: 28674ea56908edc9967ba6e60d0108c80d26ed01 [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
17import {actionTypes, typeEnum} from './GlobalModalConstants.js';
18
19export default (state = null, action) => {
20 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 };
37
38 case actionTypes.GLOBAL_MODAL_SUCCESS:
39 return {
40 type: typeEnum.SUCCESS,
41 modalClassName: 'notification-modal',
42 ...action.data
43 };
44
45 case actionTypes.GLOBAL_MODAL_CLOSE:
46 return null;
47 default:
48 return state;
49 }
50};