Axios catch will not trigger

354 views Asked by At

I have a react app that the user will enter info into a redux form and the function is called. I have a axios post that will not catch an error. I'm not sure what this is happening.

export function vehicleformsubmit(props){   
const input={
        rfidtag: rfidtag.value,
        vin: vin.value,
        vehzone: vehzone.value
};

var request=axios.post(`http://localhost:9000/api/bmwvehicle/create`, input);
return function(dispatch){
    request.then((response) =>{

        dispatch(createVehicleSuccess(response.data, response.status));

    }).catch((error) =>{
        if(error.response){
        dispatch(vehicleHaveError(true));
    }

    });
};

 }

This is that I get back:

    createError.js:16 Uncaught (in promise) Error: Request failed with 
    status code 500
    at createError (createError.js:16)
     at settle (settle.js:18)
    at XMLHttpRequest.handleLoad (xhr.js:77)
0

There are 0 answers