[Infra] Reset error state in useHTTPRequest hook (#166752)

Closes #166748 
## Summary

This PR fixes an issue with the error state - when there is a successful
request after a failed request the error state was still visible.

### Before

0cb15cab-dc7c-48ad-b080-179f0444284d

### After


e765b5e9-d213-45da-968f-257955b1f4b0
This commit is contained in:
jennypavlova 2023-09-20 14:56:04 +02:00 committed by GitHub
parent 0ba75eec8a
commit 0d18be6356
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,6 +106,7 @@ export function useHTTPRequest<Response>(
onResolve: (resp) => {
try {
setResponse(decode(resp)); // Catch decoding errors
setError(null);
} catch (e) {
onError(e);
}