mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-26 13:21:42 +03:00
Remove redundant function.
This commit is contained in:
parent
32c451fe82
commit
6d63a11d4f
@ -1,7 +1,7 @@
|
||||
module Server.Request exposing
|
||||
( Parser
|
||||
, succeed, fromResult, skip
|
||||
, formData, formDataWithoutServerValidation, formDataWithServerValidation
|
||||
, formData, formDataWithServerValidation
|
||||
, rawFormData
|
||||
, method, rawBody, allCookies, rawHeaders, queryParams
|
||||
, requestTime, optionalHeader, expectContentType, expectJsonBody
|
||||
@ -26,7 +26,7 @@ module Server.Request exposing
|
||||
|
||||
## Forms
|
||||
|
||||
@docs formData, formDataWithoutServerValidation, formDataWithServerValidation
|
||||
@docs formData, formDataWithServerValidation
|
||||
|
||||
@docs rawFormData
|
||||
|
||||
@ -883,42 +883,6 @@ fileField_ name =
|
||||
|> Internal.Request.Parser
|
||||
|
||||
|
||||
{-| -}
|
||||
formDataWithoutServerValidation :
|
||||
List
|
||||
(Form.Form
|
||||
error
|
||||
{ all | combine : Validation error combined kind constraints }
|
||||
data
|
||||
)
|
||||
-> Parser (Result { fields : List ( String, String ), errors : Dict String (List error) } combined)
|
||||
formDataWithoutServerValidation formParsers =
|
||||
rawFormData
|
||||
|> andThen
|
||||
(\rawFormData_ ->
|
||||
let
|
||||
( maybeDecoded, errors ) =
|
||||
Form.runOneOfServerSide
|
||||
rawFormData_
|
||||
formParsers
|
||||
in
|
||||
case ( maybeDecoded, errors |> Dict.toList |> List.filter (\( _, value ) -> value |> List.isEmpty |> not) |> List.NonEmpty.fromList ) of
|
||||
( Just decoded, Nothing ) ->
|
||||
succeed (Ok decoded)
|
||||
|
||||
( _, maybeErrors ) ->
|
||||
Err
|
||||
{ fields = rawFormData_
|
||||
, errors =
|
||||
maybeErrors
|
||||
|> Maybe.map List.NonEmpty.toList
|
||||
|> Maybe.withDefault []
|
||||
|> Dict.fromList
|
||||
}
|
||||
|> succeed
|
||||
)
|
||||
|
||||
|
||||
{-| -}
|
||||
formDataWithServerValidation :
|
||||
List
|
||||
|
Loading…
Reference in New Issue
Block a user