chore: only throws errors in usePayloadAPI if signal is not aborted

This commit is contained in:
James
2023-03-13 13:54:58 -04:00
parent ccc92fdb75
commit d5bf957c8e

View File

@@ -65,8 +65,10 @@ const usePayloadAPI: UsePayloadAPI = (url, options = {}) => {
setData(json);
setIsLoading(false);
} catch (error) {
setIsError(true);
setIsLoading(false);
if (!abortController.signal.aborted) {
setIsError(true);
setIsLoading(false);
}
}
};