mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-25 04:43:03 +03:00
Handle form result in case expression in route generator.
This commit is contained in:
parent
2c3665c70f
commit
154a4ff0b0
@ -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 )
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user