Created
September 13, 2019 19:00
-
-
Save Luiz-Monad/5bf2b19a82593699e1fe9c2d67ef689d to your computer and use it in GitHub Desktop.
Delayed computation example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg { | |
let! xn = ApiSubmit ( API.GetWorker ) | |
match xn with | |
//match! User.Get with | |
| Ok data -> | |
yield StorageSave ( DataKey.User, data ) | |
| Error (e: FableUtil.FetchUtil.Response) -> | |
yield ApplicationError <| string e.Status + " " + e.StatusText | |
match loadUser () with | |
| Some user -> | |
yield user |> UserIndex.Message.Load |> PageMsg.UserIndex |> PageMessage | |
| _ -> () | |
} | |
//somewhere else in a global message loop | |
| Continuation ( ( APICall apiModel ), next ), _ -> | |
model | |
, Cmd.OfPromise.either API.submit apiModel | |
( fun _ -> next ) | |
( fun e -> alert "Erro" e.Message ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment