Handle form result in case expression in route generator.

This commit is contained in:
Dillon Kearns 2023-03-04 07:39:10 -08:00
parent 2c3665c70f
commit 154a4ff0b0

View File

@ -134,18 +134,40 @@ createFile { moduleName, fields } =
"response" "response"
"parsedForm" "parsedForm"
(\response parsedForm -> (\response parsedForm ->
Gen.Debug.toString parsedForm Elm.Case.result parsedForm
|> Gen.Pages.Script.call_.log { err =
|> Gen.BackendTask.call_.map ( "error"
(Elm.fn ( "_", Nothing ) , \error ->
(\_ -> Gen.Debug.toString error
Response.render |> Gen.Pages.Script.call_.log
(Elm.record |> Gen.BackendTask.call_.map
[ ( "errors", response ) (Elm.fn ( "_", Nothing )
] (\_ ->
Response.render
(Elm.record
[ ( "errors", response )
]
)
)
) )
)
) )
, ok =
( "okForm"
, \okForm ->
Gen.Debug.toString okForm
|> Gen.Pages.Script.call_.log
|> Gen.BackendTask.call_.map
(Elm.fn ( "_", Nothing )
(\_ ->
Response.render
(Elm.record
[ ( "errors", response )
]
)
)
)
)
}
) )
) )
) )