Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Commit

Permalink
Part 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sudaraka committed Sep 23, 2017
1 parent 90682a5 commit 67f038d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions part8/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ type Msg

decodeResponse : Value -> Msg
decodeResponse json =
-- TODO use decodeValue to decode the response into a Msg.
--
-- Hint: look at the definition of Msg and
-- the definition of responseDecoder
HandleSearchError (Just "TODO decode the response!")
case decodeValue responseDecoder json of
Ok result ->
HandleSearchResponse result

Err msg ->
HandleSearchError (Just msg)


port githubSearch : String -> Cmd msg
Expand Down
4 changes: 2 additions & 2 deletions part8/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
github.getSearch(query).repositories({}, function (err, repositories) {
console.log("Got response", repositories);

// TODO: app.ports.portNameGoesHere.send(repositories);
app.ports.githubResponse.send(repositories)
});
}

// TODO app.ports.portNameGoesHere.subscribe(searchGithub);
app.ports.githubSearch.subscribe(searchGithub)
</script>

</html>

0 comments on commit 67f038d

Please sign in to comment.