Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
export const customerFeatureKey = 'Customer';
export interface State {customers: Customer[]}
export interface CustomerAppState {
[customerFeatureKey]: State;
}
export const initialState: State = {customers: []};
export const customerReducer = createReducer<State>(
initialState,
on(CustomerActions.loaded, (state, { customers }) => ({...state, customers})),
on(CustomerActions.added, (state, { customers }) => ({...state, customers})),
on(CustomerActions.updated, (state, { customers }) => ({...state, customers})),
on(CustomerActions.removed, (state, { customers }) => ({...state, customers}))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment