import { createReducer, on } from '@ngrx/store'; import { initialState } from './state'; import { loginSuccess, logoutSuccess } from './actions'; export const reducer = createReducer( initialState, on(loginSuccess, (state, action) => { return { ...state, loginRes: action.res }; }), on(logoutSuccess, (state, action) => { return { ...initialState }; }) );