import { reducers as appReducers } from './app';
import { reducers as interactionReducers } from './interaction';

export { actions as appActions } from './app';
export { actions as interactionActions } from './interaction';

const reducers = [appReducers, interactionReducers];

const initialState = {
  loading: false,
  id: null,
  mobileURL: '',
  name: '',
  config: {},
  activePage: null,
  pages: [],
  pageAnimation: undefined,
  renderCheck: 2 // 2=>pending状态，为了解决在进入终端前不建立连接 1=>需要检查密码 0=>不需要密码
};

export default function reducer(state = initialState, action) {
  let newState;
  switch (action.type) {
    default:
      newState = state;
      break;
  }
  return reducers.reduce((s, r) => r(s, action), newState);
}
