Wraps an async callback with reactive isLoading/apiData state.
Error contract (Pattern A of the error-handling policy): if callback
throws, the failure is wrapped in an ApiCallError (the original error is
preserved on .cause), onError (when provided) is invoked with that
ApiCallError, and it is then always rethrown from callApi. A caller
that doesn't pass onError still learns about the failure - it just has to
await/.catch()callApi itself, the same as it would for any other
async function.
Wraps an async callback with reactive isLoading/apiData state.
Error contract (Pattern A of the error-handling policy): if
callbackthrows, the failure is wrapped in anApiCallError(the original error is preserved on.cause),onError(when provided) is invoked with thatApiCallError, and it is then always rethrown fromcallApi. A caller that doesn't passonErrorstill learns about the failure - it just has toawait/.catch()callApiitself, the same as it would for any other async function.