Update README

This commit is contained in:
Correl Roush 2018-01-22 17:02:21 -05:00
parent 075d9475e2
commit 21bbd017a6

View file

@ -26,11 +26,11 @@ to mean the final page of results has been reached.
import Paginated exposing (Response(..)) import Paginated exposing (Response(..))
type alias Model = type alias Model =
{ results : Maybe (Paginated.Response String) } { results : Maybe (List String) }
type Msg type Msg
= Search = Search
| Results (Result Http.Error (Paginated.Response String)) | Results (Result Http.Error (List String))
update : Msg -> Model -> ( Model, Cmd Msg ) update : Msg -> Model -> ( Model, Cmd Msg )
update msg model = update msg model =
@ -38,30 +38,12 @@ to mean the final page of results has been reached.
Search -> Search ->
( model, doSearch ) ( model, doSearch )
Results (Ok response) -> Results results ->
case response of ( { model | results = Result.toMaybe results }
Partial request results ->
( { model
| results =
Maybe.map (\x -> Paginated.update x response)
model.results
}
, Paginated.send Results request
)
Complete results ->
( { model
| results =
Maybe.map (\x -> Paginated.update x response)
model.results
}
, Cmd.none , Cmd.none
) )
Results (Err _) ->
( model, Cmd.none )
doSearch : Cmd Msg doSearch : Cmd Msg
doSearch = doSearch =
Paginated.send Results <| Paginated.send Results <|
Paginated.get "http://example.com/items" string Paginated.get "http://example.com/search?q=abc" string