Reorganize part9

This commit is contained in:
Richard Feldman
2016-09-06 20:21:14 -07:00
parent 3456b14f7e
commit 9878f5d993
2 changed files with 22 additions and 23 deletions

View File

@@ -1,31 +1,14 @@
port module Main exposing (..)
module Main exposing (..)
import ElmHub exposing (..)
import Html.App as Html
import Json.Decode
main : Program Never
main =
Html.program
{ view = view
, update = update githubSearch
, update = update
, init = ( initialModel, githubSearch (getQueryString initialModel.query) )
, subscriptions = \_ -> githubResponse decodeResponse
}
decodeResponse : Json.Decode.Value -> Msg
decodeResponse json =
case Json.Decode.decodeValue responseDecoder json of
Err err ->
HandleSearchError (Just err)
Ok results ->
HandleSearchResponse results
port githubSearch : String -> Cmd msg
port githubResponse : (Json.Decode.Value -> msg) -> Sub msg