4d696f2253
* Use collection label instead of name on the CollectionPage * Added Avatar and logout menu item * [feat](login) Added userpic with a logout action in the dropdown. - Display logged in user in the AppHeader - Implemented logout action and store + tests - Better styles for GitHub sign in screen Closes #100 * Better styles for the AppHeader
20 lines
542 B
JavaScript
20 lines
542 B
JavaScript
import Immutable from 'immutable';
|
|
import { AUTH_REQUEST, AUTH_SUCCESS, AUTH_FAILURE, LOGOUT } from '../actions/auth';
|
|
|
|
const auth = (state = null, action) => {
|
|
switch (action.type) {
|
|
case AUTH_REQUEST:
|
|
return Immutable.Map({ isFetching: true });
|
|
case AUTH_SUCCESS:
|
|
return Immutable.fromJS({ user: action.payload });
|
|
case AUTH_FAILURE:
|
|
return Immutable.Map({ error: action.payload.toString() });
|
|
case LOGOUT:
|
|
return state.remove('user');
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|
|
export default auth;
|