Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created October 26, 2015 07:31
Show Gist options
  • Save amitaibu/f9e06dabbefe0de5b295 to your computer and use it in GitHub Desktop.
Save amitaibu/f9e06dabbefe0de5b295 to your computer and use it in GitHub Desktop.
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