mirror of
https://github.com/correl/elm-paginated.git
synced 2024-11-23 11:09:51 +00:00
Clean up code and remove unused dependencies
This commit is contained in:
parent
da45f3f94a
commit
385d9d242a
3 changed files with 8 additions and 13 deletions
|
@ -12,7 +12,6 @@
|
|||
"dependencies": {
|
||||
"elm-community/maybe-extra": "4.0.0 <= v < 5.0.0",
|
||||
"elm-lang/core": "5.1.1 <= v < 6.0.0",
|
||||
"elm-lang/html": "2.0.0 <= v < 3.0.0",
|
||||
"elm-lang/http": "1.0.0 <= v < 2.0.0"
|
||||
},
|
||||
"elm-version": "0.18.0 <= v < 0.19.0"
|
||||
|
|
|
@ -37,7 +37,6 @@ import Char
|
|||
import Dict exposing (Dict)
|
||||
import Http
|
||||
import Json.Decode exposing (Decoder)
|
||||
import Maybe.Extra
|
||||
import Paginated.Util
|
||||
import Task exposing (Task)
|
||||
import Time
|
||||
|
@ -214,18 +213,13 @@ fromResponse options response =
|
|||
(Json.Decode.list options.decoder)
|
||||
response.body
|
||||
|
||||
normalize : Dict String String -> Dict String String
|
||||
normalize =
|
||||
Dict.toList
|
||||
>> Dict.fromList
|
||||
|
||||
nextPage : Maybe String
|
||||
nextPage =
|
||||
header "Link" response.headers
|
||||
|> Maybe.map Paginated.Util.links
|
||||
|> Maybe.andThen (Dict.get "next")
|
||||
in
|
||||
case Debug.log "nextPage" nextPage of
|
||||
case nextPage of
|
||||
Nothing ->
|
||||
Result.map Complete items
|
||||
|
||||
|
|
|
@ -25,11 +25,13 @@ links s =
|
|||
_ ->
|
||||
Nothing
|
||||
in
|
||||
Regex.find
|
||||
Regex.All
|
||||
(Regex.regex "<(.*?)>; rel=\"(.*?)\"")
|
||||
s
|
||||
Regex.find Regex.All linkPattern s
|
||||
|> List.map .submatches
|
||||
|> List.map toTuples
|
||||
|> Maybe.Extra.values
|
||||
|> Dict.fromList
|
||||
|
||||
|
||||
linkPattern : Regex.Regex
|
||||
linkPattern =
|
||||
Regex.regex "<(.*?)>; rel=\"(.*?)\""
|
||||
|
|
Loading…
Reference in a new issue