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"
|
||||
"parsedForm"
|
||||
(\response parsedForm ->
|
||||
Gen.Debug.toString parsedForm
|
||||
|> Gen.Pages.Script.call_.log
|
||||
|> Gen.BackendTask.call_.map
|
||||
(Elm.fn ( "_", Nothing )
|
||||
(\_ ->
|
||||
Response.render
|
||||
(Elm.record
|
||||
[ ( "errors", response )
|
||||
]
|
||||
Elm.Case.result parsedForm
|
||||
{ err =
|
||||
( "error"
|
||||
, \error ->
|
||||
Gen.Debug.toString error
|
||||
|> Gen.Pages.Script.call_.log
|
||||
|> Gen.BackendTask.call_.map
|
||||
(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