Skip to content

Instantly share code, notes, and snippets.

@adrianfaciu
Created May 8, 2018 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 adrianfaciu/7ea702e71e64114d574665672799fdab to your computer and use it in GitHub Desktop.
Save adrianfaciu/7ea702e71e64114d574665672799fdab to your computer and use it in GitHub Desktop.
export function reducer(state = initialState, action: AuthActionsUnion): State {
switch (action.type) {
case AuthActionTypes.LoginSuccess: {
return {
...state,
loggedIn: true,
user: action.payload.user,
};
}
case AuthActionTypes.Logout: {
return initialState;
}
default: {
return state;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment