import { createReducer, on } from '@ngrx/store';

import * as AuthenticationStore from '@app/store/account/authentication';

import { initialState } from './state';
import { companyListSuccess } from './actions';

export const reducer = createReducer(
  initialState,
  on(companyListSuccess, (state, action) => {
    return {
      ...state,
      companyList: action.companyList
    };
  }),

  on(AuthenticationStore.logoutInitialize, (state, action) => {
    return {
      ...initialState
    };
  })
);
