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