Axios捕获将不会触发

时间:2018-11-09 16:32:54

标签: react-redux axios redux-form react-thunk

我有一个react应用,用户将以redux形式输入信息并调用该函数。我有一个axios帖子,不会捕获错误。我不确定这是怎么回事。

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));
    }

    });
};

 }

我回来了:

    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 个答案:

没有答案