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