Skip to content

Instantly share code, notes, and snippets.

@panvourtsis
Created June 12, 2019 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panvourtsis/5f2aff1a7fde808d0df088a865bbd783 to your computer and use it in GitHub Desktop.
Save panvourtsis/5f2aff1a7fde808d0df088a865bbd783 to your computer and use it in GitHub Desktop.
import { SET_USER, SET_USER_TOKEN, UNSET_USER, UserActionTypes } from './types';
import { User } from './types';
const initialState: User = {
id: null,
name: '',
email: '',
};
function userInfo(state = initialState, action: UserActionTypes): User {
switch (action.type) {
case SET_USER_TOKEN:
return {
...state,
token: action.payload,
};
default:
return state;
}
}
export default userInfo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment