mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-26 13:21:42 +03:00
Remove unused.
This commit is contained in:
parent
0dac6a0916
commit
cc30fc028a
@ -527,7 +527,6 @@ config =
|
||||
.filter((segment) => segment !== "")
|
||||
.map((segment) => `"${segment}"`)
|
||||
.join(", ")} ]
|
||||
, fetchPageData = fetchPageData
|
||||
, sendPageData = sendPageData
|
||||
, byteEncodePageData = byteEncodePageData
|
||||
, byteDecodePageData = byteDecodePageData
|
||||
@ -587,56 +586,6 @@ ${templates
|
||||
|
||||
port sendPageData : Pages.Internal.Platform.ToJsPayload.NewThingForPort -> Cmd msg
|
||||
|
||||
fetchPageData : Url -> Maybe { contentType : String, body : String } -> Task Http.Error ( Url, ResponseSketch PageData Shared.Data )
|
||||
fetchPageData url details =
|
||||
Http.task
|
||||
{ method = details |> Maybe.map (\\_ -> "POST") |> Maybe.withDefault "GET"
|
||||
, headers = []
|
||||
, url =
|
||||
url.path
|
||||
|> Pages.Internal.String.chopForwardSlashes
|
||||
|> String.split "/"
|
||||
|> List.filter ((/=) "")
|
||||
|> (\\l -> l ++ [ "content.dat" ])
|
||||
|> String.join "/"
|
||||
|> String.append "/"
|
||||
, body = details |> Maybe.map (\\justDetails -> Http.stringBody justDetails.contentType justDetails.body) |> Maybe.withDefault Http.emptyBody
|
||||
, resolver =
|
||||
Http.bytesResolver
|
||||
(\\response ->
|
||||
case response of
|
||||
Http.BadUrl_ url_ ->
|
||||
Err (Http.BadUrl url_)
|
||||
|
||||
Http.Timeout_ ->
|
||||
Err Http.Timeout
|
||||
|
||||
Http.NetworkError_ ->
|
||||
Err Http.NetworkError
|
||||
|
||||
Http.BadStatus_ metadata _ ->
|
||||
Err (Http.BadStatus metadata.statusCode)
|
||||
|
||||
Http.GoodStatus_ _ body ->
|
||||
body
|
||||
|> decodeBytes decodeResponse
|
||||
|> Result.mapError Http.BadBody
|
||||
|> Result.map (\\okResponse -> ( url, okResponse ))
|
||||
)
|
||||
, timeout = Nothing
|
||||
}
|
||||
|> Task.andThen
|
||||
(\\( _, response ) ->
|
||||
case response of
|
||||
Pages.Internal.ResponseSketch.Redirect location ->
|
||||
-- TODO what if it redirects to external URL? Need to handle that somehow, or is it an error?
|
||||
fetchPageData { url | path = location } Nothing
|
||||
|
||||
_ ->
|
||||
Task.succeed ( url, response )
|
||||
)
|
||||
|
||||
|
||||
|
||||
byteDecodePageData : Maybe Route -> Bytes.Decode.Decoder PageData
|
||||
byteDecodePageData route =
|
||||
|
@ -80,7 +80,6 @@ type alias ProgramConfig userMsg userModel route pageData sharedData effect mapp
|
||||
-> List (ApiRoute.ApiRoute ApiRoute.Response)
|
||||
, pathPatterns : List RoutePattern
|
||||
, basePath : List String
|
||||
, fetchPageData : Url -> Maybe { contentType : String, body : String } -> Task Http.Error ( Url, ResponseSketch pageData sharedData )
|
||||
, sendPageData : Pages.Internal.Platform.ToJsPayload.NewThingForPort -> Cmd Never
|
||||
, byteEncodePageData : pageData -> Bytes.Encode.Encoder
|
||||
, byteDecodePageData : route -> Bytes.Decode.Decoder pageData
|
||||
|
Loading…
Reference in New Issue
Block a user