File size: 617 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import {
RECEIVE_CURRENT_USER,
LOGOUT_CURRENT_USER,
} from '../actions/session_actions';
const _nullUser = Object.freeze({
id: null
});
const sessionReducer = (state = _nullUser, action) => {
Object.freeze(state);
switch (action.type) {
// case RECEIVE_CURRENT_USER:
// return { id: action.currentUser.id };
case RECEIVE_CURRENT_USER:
return { currentUserId: Object.values(action.currentUser.users)[0].id };
case LOGOUT_CURRENT_USER:
return _nullUser;
default:
return state;
}
};
export default sessionReducer; |