const LOGINNETWORKERROR = 'LOGINNETWORKERROR';
const LOGINNETWORKERRORRESET = 'LOGINNETWORKERRORRESET';
const LOGIN = 'LOGIN';
const LOGOUT = 'LOGOUT';

export const actionLoginNetworkError = () => {
    return {
        type: LOGINNETWORKERROR
    }
}

export const actionLoginNetworkErrorReset = () => {
    return {
        type: LOGINNETWORKERRORRESET
    }
}

export const networkErrorReducer = (state, action) => {
    if(!state) {
        return {
            loginNetworkError: false
        }
    }
    
    switch(action.type) {
        case LOGINNETWORKERROR: 
            return {
                ...state,
                loginNetworkError: true
            }
        case LOGINNETWORKERRORRESET: 
            return {
                ...state,
                loginNetworkError: false
            }
        case LOGIN:
            return {};
        case LOGOUT:
            return {};
        default:
            return state
    }
}