diff --git a/part7/ElmHub.elm b/part7/ElmHub.elm index ef71143..ee88a60 100644 --- a/part7/ElmHub.elm +++ b/part7/ElmHub.elm @@ -4,16 +4,15 @@ import Html exposing (..) import Html.Attributes exposing (class, target, href, property, defaultValue) import Html.Events exposing (..) import Auth -import Task exposing (Task) import Json.Decode exposing (Decoder) import Json.Decode.Pipeline exposing (..) import Json.Encode -getQueryUrl : String -> String -getQueryUrl query = +getQueryString : String -> String +getQueryString query = -- See https://developer.github.com/v3/search/#example for how to customize! - "https://api.github.com/search/repositories?access_token=" + "access_token=" ++ Auth.token ++ "&q=" ++ query @@ -107,7 +106,7 @@ update : (String -> Cmd Msg) -> Msg -> Model -> ( Model, Cmd Msg ) update searchFeed msg model = case msg of Search -> - ( model, searchFeed (getQueryUrl model.query) ) + ( model, searchFeed (getQueryString model.query) ) SetQuery query -> ( { model | query = query }, Cmd.none ) diff --git a/part7/Main.elm b/part7/Main.elm index a736ba5..faa0c13 100644 --- a/part7/Main.elm +++ b/part7/Main.elm @@ -10,7 +10,7 @@ main = Html.App.program { view = view , update = update githubSearch - , init = ( initialModel, githubSearch (getQueryUrl initialModel.query) ) + , init = ( initialModel, githubSearch (getQueryString initialModel.query) ) , subscriptions = \_ -> githubResponse decodeResponse } diff --git a/part7/index.html b/part7/index.html index a452416..0b7441a 100644 --- a/part7/index.html +++ b/part7/index.html @@ -22,9 +22,8 @@ function searchGithub(query) { console.log("Searching for", query); - var search = github.getSearch(query); - search.repositories({}, function (err, repositories) { + github.getSearch(query).repositories({}, function (err, repositories) { console.log("Got response", repositories); // TODO: app.ports.portNameGoesHere.send(repositories); diff --git a/part8/ElmHub.elm b/part8/ElmHub.elm index ef71143..ee88a60 100644 --- a/part8/ElmHub.elm +++ b/part8/ElmHub.elm @@ -4,16 +4,15 @@ import Html exposing (..) import Html.Attributes exposing (class, target, href, property, defaultValue) import Html.Events exposing (..) import Auth -import Task exposing (Task) import Json.Decode exposing (Decoder) import Json.Decode.Pipeline exposing (..) import Json.Encode -getQueryUrl : String -> String -getQueryUrl query = +getQueryString : String -> String +getQueryString query = -- See https://developer.github.com/v3/search/#example for how to customize! - "https://api.github.com/search/repositories?access_token=" + "access_token=" ++ Auth.token ++ "&q=" ++ query @@ -107,7 +106,7 @@ update : (String -> Cmd Msg) -> Msg -> Model -> ( Model, Cmd Msg ) update searchFeed msg model = case msg of Search -> - ( model, searchFeed (getQueryUrl model.query) ) + ( model, searchFeed (getQueryString model.query) ) SetQuery query -> ( { model | query = query }, Cmd.none ) diff --git a/part8/Main.elm b/part8/Main.elm index a736ba5..faa0c13 100644 --- a/part8/Main.elm +++ b/part8/Main.elm @@ -10,7 +10,7 @@ main = Html.App.program { view = view , update = update githubSearch - , init = ( initialModel, githubSearch (getQueryUrl initialModel.query) ) + , init = ( initialModel, githubSearch (getQueryString initialModel.query) ) , subscriptions = \_ -> githubResponse decodeResponse } diff --git a/part8/index.html b/part8/index.html index 98f4ac1..a30f61e 100644 --- a/part8/index.html +++ b/part8/index.html @@ -22,9 +22,8 @@ function searchGithub(query) { console.log("Searching for", query); - var search = github.getSearch(query); - search.repositories({}, function (err, repositories) { + github.getSearch(query).repositories({}, function (err, repositories) { console.log("Got response", repositories); app.ports.githubResponse.send(repositories);