import { createReducer, on } from '@ngrx/store';
import { ADD_PROFILE } from './profile.actions';
import {
  LOGIN_RESPONSE,
  Profile,
  USER,
} from '../../models/authenticcation.model';

const initialState: { profile: LOGIN_RESPONSE | null } = {
  profile: null,
};

export const profileReducer = createReducer(
  initialState,
  on(ADD_PROFILE, (state, { user }) => ({
    ...state,
    profile: user,
  }))
);
