Created
October 26, 2015 07:31
-
-
Save amitaibu/f9e06dabbefe0de5b295 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
getJson : String -> String -> Effects Action | |
getJson url accessToken = | |
let | |
encodedUrl = Http.url url [ ("access_token", accessToken) ] | |
httpTask = | |
Task.toResult <| | |
Http.get decodeData encodedUrl | |
actionTask = | |
httpTask `andThen` (\result -> | |
Task.map (\timestamp -> | |
UpdateDataFromServer result timestamp | |
) getCurrentTime | |
) | |
in | |
Effects.task actionTask |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment