Store null if requestor/subject is not entered (#12)

The output was fine; the form was parsing `Some ""` instead of `None` as the code was expecting
This commit is contained in:
Daniel J. Summers 2019-06-06 14:22:40 -05:00
parent 43b6b6d8e0
commit 087595ee75

View File

@ -261,8 +261,7 @@ let save : HttpHandler =
>=> validateCSRF
>=> fun next ctx ->
task {
let! result = ctx.TryBindFormAsync<EditRequest> ()
match result with
match! ctx.TryBindFormAsync<EditRequest> () with
| Ok m ->
let db = ctx.dbContext ()
let! req =
@ -274,7 +273,7 @@ let save : HttpHandler =
let upd8 =
{ pr with
requestType = PrayerRequestType.fromCode m.requestType
requestor = m.requestor
requestor = match m.requestor with Some x when x.Trim () = "" -> None | x -> x
text = ckEditorToText m.text
expiration = Expiration.fromCode m.expiration
}