<commit_before>import {combineReducers} from 'redux';
import {LOCATION_CHANGE} from 'react-router-redux';

import {
    SIGN_IN_REQUEST, SIGN_IN_SUCCESS, SIGN_IN_FAILURE,
    SIGN_UP_REQUEST, SIGN_UP_SUCCESS, SIGN_UP_FAILURE,
    SIGN_OUT_REQUEST
} from './constants';


const initialAuthState = {
    pending: false,
    errors: {},
    user: null
};

const auth = (state = initialAuthState, action) => {
    switch (action.type) {
    case LOCATION_CHANGE:
        return Object.assign({}, state, {
            errors: {}
        });
    case SIGN_IN_REQUEST:
    case SIGN_UP_REQUEST:
        return Object.assign({}, state, {
            pending: true
        });
    case SIGN_IN_SUCCESS:
    case SIGN_UP_SUCCESS:
        return Object.assign({}, state, {
            pending: false,
            errors: {},
            user: action.user
        });
    case SIGN_IN_FAILURE:
    case SIGN_UP_FAILURE:
        return Object.assign({}, state, {
            pending: false,
            errors: action.errors
        });
    case SIGN_OUT_REQUEST:
        return Object.assign({}, state, initialAuthState);
    default:
        return state;
    }
};

export default combineReducers({auth});<commit_msg>Updated membership reducers to use namespace import; minor cleanup with state change.<commit_after>import {combineReducers} from 'redux';
import {LOCATION_CHANGE} from 'react-router-redux';

import * as types from './constants';


const initialAuthState = {
    pending: false,
    errors: {},
    user: null
};

const auth = (state = initialAuthState, action) => {
    switch (action.type) {
    case LOCATION_CHANGE:
        return Object.assign({}, state, {
            errors: {}
        });
    case types.SIGN_IN_REQUEST:
    case types.SIGN_UP_REQUEST:
        return Object.assign({}, state, {
            pending: true
        });
    case types.SIGN_IN_SUCCESS:
    case types.SIGN_UP_SUCCESS:
        return Object.assign({}, {
            pending: false,
            errors: {},
            user: action.user
        });
    case types.SIGN_IN_FAILURE:
    case types.SIGN_UP_FAILURE:
        return Object.assign({}, {
            pending: false,
            errors: action.errors,
            user: null
        });
    case types.SIGN_OUT_REQUEST:
        return Object.assign({}, initialAuthState);
    default:
        return state;
    }
};

export default combineReducers({auth});
{'fraction_non_alphanumeric': 0.11101871101871102, 'fraction_numerical': 0.0, 'mean_word_length': 2.346314325452017, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '218440', 'n_tokens_mistral': 705, 'n_tokens_neox': 719, 'n_words': 168}