2016-06-23 22:29:55 +00:00
|
|
|
import * as ActionTypes from '../../constants';
|
2016-06-09 20:28:21 +00:00
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
const user = (state = { authenticated: false }, action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case ActionTypes.AUTH_USER:
|
|
|
|
return { ...action.user,
|
|
|
|
authenticated: true };
|
2016-08-28 00:46:20 +00:00
|
|
|
case ActionTypes.UNAUTH_USER:
|
|
|
|
return {
|
|
|
|
authenticated: false
|
|
|
|
};
|
2016-06-23 22:29:55 +00:00
|
|
|
case ActionTypes.AUTH_ERROR:
|
|
|
|
return {
|
|
|
|
authenticated: false
|
|
|
|
};
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
2016-06-09 20:28:21 +00:00
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
export default user;
|