File size: 472 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({
currentUserId: null
});
const sessionReducer = (state = _nullUser, action) => {
Object.freeze(state);
switch (action.type) {
case RECEIVE_CURRENT_USER:
return { currentUserId: action.currentUser.id };
case LOGOUT_CURRENT_USER:
return _nullUser;
default:
return state;
}
};
export default sessionReducer;
|