Last active
August 12, 2021 12:43
-
-
Save rainerhahnekamp/dd1747da0bd4aa81c46ca033f20780ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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