const LOGINNETWORKERROR = 'LOGINNETWORKERROR';
const LOGINNETWORKERRORRESET = 'LOGINNETWORKERRORRESET';

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
            }
        default:
            return state
    }
}