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

import { StaffsApiActions } from './staff.actions';
import { StaffView } from '../models';
import { AppState } from './app.state';

export const initialState: AppState ={
  staffs:[],
  staffloaded: false
}

export const staffsReducer = createReducer(
  initialState,
  on(StaffsApiActions.loadStaffSuccess, (
    state, action) => {
         return {
        ...state,
        staffs: action.staffs,
        staffloaded: true

      }
    }
)
);
