Closed TimLariviere closed 2 years ago
Cmd.ofAsyncResult is useful when dealing with API calls
module Server = let getDataAsync () = async { let! response = ... if response.StatusCode = Unauthorized then return Error "Unauthorized" else return Ok response.Data } Cmd.ofAsyncResult Server.getDataAsync (fun data -> DataRetrievedSuccessfully data) (fun error -> DataRetrievalError error) (fun ex -> DataRetrievalFailure ex)
Cmd.ofAsyncResult is useful when dealing with API calls