blob: cffd34603e1813daddebb0807d5960613c3485d1 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001/* tslint:disable no-switch-case-fall-through */
2import {Action} from 'redux';
3import {UPDATE_FLAGS, UPDATE_NAME, UpdateFlagsAction, UpdateGlobalAction} from "./global.actions";
4
5
6
7export interface GlobalState {
8 name : string;
9 flags : { [key: string]: boolean };
10}
11
12const initialState: GlobalState = {
13 name : null,
14 flags : null
15};
16
17
18export const GlobalReducer =
19 function (state: GlobalState = initialState, action: Action): GlobalState {
20 switch (action.type) {
21 case UPDATE_NAME:
22 return Object.assign(state, state, (<UpdateGlobalAction>action));
23 case UPDATE_FLAGS:
24 Object.assign(state, (<UpdateFlagsAction>action));
25 return Object.assign({}, state);
26 default:
27 return state;
28 }
29 };