Skip to content

Instantly share code, notes, and snippets.

@kingsley-einstein
Created June 26, 2020 16:55
Show Gist options
  • Save kingsley-einstein/3e36b2930affe044f5e57360d7a95895 to your computer and use it in GitHub Desktop.
Save kingsley-einstein/3e36b2930affe044f5e57360d7a95895 to your computer and use it in GitHub Desktop.
import { UserState, initialUserState } from '../../states';
import { UserActionTypes, UserActionUnion } from '../../actions';
export default (state: UserState = initialUserState, action: UserActionUnion) : UserState => {
switch (action.type) {
case UserActionTypes.LoadUser:
return {
...state,
data: action.payload.data
};
case UserActionTypes.LoadUsers:
return {
...state,
users: action.payload.data
};
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment