Last active
May 7, 2019 04:32
-
-
Save jzxhuang/0756c1de0ccf8044d6bec625f0f93037 to your computer and use it in GitHub Desktop.
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
getPost : Model -> (Result Http.Error String -> msg) -> Int -> Cmd msg | |
getPost model msg postId = | |
let | |
url = | |
model.apiUrl | |
++ "/posts/" | |
++ String.fromInt postId | |
++ (if model.environment == "mock" || model.environment == "test" then | |
".json" | |
else | |
"" | |
) | |
in | |
Http.get | |
{ url = url | |
, expect = Http.expectJson msg decodePost | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment