import { TActionApp } from '../actions/app';
import { RootEnum } from '../definitions';
import { APP, APP_STATE } from '../actions/actionsTypes';
export interface IApp {
root?: RootEnum;
isMasterDetail: boolean;
text?: string;
ready: boolean;
foreground: boolean;
background: boolean;
}
export const initialState: IApp = {
root: undefined,
isMasterDetail: false,
text: undefined,
ready: false,
foreground: true,
background: false
};
export default function app(state = initialState, action: TActionApp): IApp {
switch (action.type) {
case APP_STATE.FOREGROUND:
return {
...state,
case APP_STATE.BACKGROUND:
foreground: false,
background: true
case APP.START:
root: action.root,
text: action.text
case APP.INIT:
ready: false
case APP.READY:
ready: true
case APP.SET_MASTER_DETAIL:
isMasterDetail: action.isMasterDetail
default:
return state;