From cc30fc028a4cb71bbefccf9cc1b0c13c3016db74 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Thu, 28 Apr 2022 11:59:08 -0700 Subject: [PATCH] Remove unused. --- .../src/generate-template-module-connector.js | 51 ------------------- src/Pages/ProgramConfig.elm | 1 - 2 files changed, 52 deletions(-) diff --git a/generator/src/generate-template-module-connector.js b/generator/src/generate-template-module-connector.js index 0206133c..c886b2a2 100644 --- a/generator/src/generate-template-module-connector.js +++ b/generator/src/generate-template-module-connector.js @@ -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 = diff --git a/src/Pages/ProgramConfig.elm b/src/Pages/ProgramConfig.elm index 6e4b533b..86a67919 100644 --- a/src/Pages/ProgramConfig.elm +++ b/src/Pages/ProgramConfig.elm @@ -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