mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-25 04:43:03 +03:00
Migrate more code.
This commit is contained in:
parent
6e5470cd54
commit
dc92df986f
@ -158,7 +158,7 @@ otherFile routes phaseString =
|
|||||||
, byteEncodePageData = todo
|
, byteEncodePageData = todo
|
||||||
, byteDecodePageData = todo
|
, byteDecodePageData = todo
|
||||||
, encodeResponse = encodeResponse.reference
|
, encodeResponse = encodeResponse.reference
|
||||||
, encodeAction = todo
|
, encodeAction = Elm.val "encodeActionData"
|
||||||
, decodeResponse = decodeResponse.reference
|
, decodeResponse = decodeResponse.reference
|
||||||
, globalHeadTags =
|
, globalHeadTags =
|
||||||
case phase of
|
case phase of
|
||||||
@ -302,6 +302,38 @@ otherFile routes phaseString =
|
|||||||
(Gen.DataSource.annotation_.dataSource (Type.maybe Gen.Pages.Internal.NotFoundReason.annotation_.notFoundReason))
|
(Gen.DataSource.annotation_.dataSource (Type.maybe Gen.Pages.Internal.NotFoundReason.annotation_.notFoundReason))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
encodeActionData :
|
||||||
|
{ declaration : Elm.Declaration
|
||||||
|
, call : Elm.Expression -> Elm.Expression
|
||||||
|
, callFrom : List String -> Elm.Expression -> Elm.Expression
|
||||||
|
}
|
||||||
|
encodeActionData =
|
||||||
|
Elm.Declare.fn "encodeActionData"
|
||||||
|
( "actionData", Type.named [] "ActionData" |> Just )
|
||||||
|
(\actionData ->
|
||||||
|
Elm.Case.custom actionData
|
||||||
|
Type.unit
|
||||||
|
(routes
|
||||||
|
|> List.map
|
||||||
|
(\route ->
|
||||||
|
Elm.Case.branch1
|
||||||
|
("ActionData" ++ (RoutePattern.toModuleName route |> String.join "__"))
|
||||||
|
( "thisActionData", Type.unit )
|
||||||
|
(\thisActionData ->
|
||||||
|
Elm.apply
|
||||||
|
(Elm.value
|
||||||
|
{ annotation = Nothing
|
||||||
|
, importFrom = "Route" :: RoutePattern.toModuleName route
|
||||||
|
, name = "w3_encode_ActionData"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
[ thisActionData ]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|> Elm.withType Gen.Bytes.Encode.annotation_.encoder
|
||||||
|
)
|
||||||
|
|
||||||
pathsToGenerateHandler :
|
pathsToGenerateHandler :
|
||||||
{ declaration : Elm.Declaration
|
{ declaration : Elm.Declaration
|
||||||
, reference : Elm.Expression
|
, reference : Elm.Expression
|
||||||
@ -737,6 +769,7 @@ otherFile routes phaseString =
|
|||||||
, pathsToGenerateHandler.declaration
|
, pathsToGenerateHandler.declaration
|
||||||
, getStaticRoutes.declaration
|
, getStaticRoutes.declaration
|
||||||
, handleRoute.declaration
|
, handleRoute.declaration
|
||||||
|
, encodeActionData.declaration
|
||||||
, Elm.portOutgoing "sendPageData"
|
, Elm.portOutgoing "sendPageData"
|
||||||
(Type.record
|
(Type.record
|
||||||
[ ( "oldThing", Gen.Json.Encode.annotation_.value )
|
[ ( "oldThing", Gen.Json.Encode.annotation_.value )
|
||||||
|
Loading…
Reference in New Issue
Block a user