I have the following code that makes an API call and based on HTTP response, it dispatches certain actions in my redux reducer.
The problem is that if the API call fails, it shows it in the console even though the part of the code that handles unsuccessful calls executes fine. How can I prevent that? I'm already handling unsuccessful API calls so nothing should show up in the console.
export const someApiCall = () => {
return (dispatch) => fetch('/api/somefunction', fetchOptionsGet())
.then((response) => {
if(response.ok) {
// Success. Dispatch some actions
} else {
// Failed call. Dispatch some other actions
}
})
}