Solution for intro/part5

This commit is contained in:
Richard Feldman
2018-08-14 02:08:44 -04:00
parent 412ddaa55f
commit 633a1efbd9

View File

@@ -86,11 +86,7 @@ viewForm form =
[ input
[ class "form-control form-control-lg"
, placeholder "Username"
{- 👉 TODO: when the user inputs a username, update it in the Model.
💡 HINT: Look at how the Email input below does this. 👇
-}
, onInput EnteredUsername
, value form.username
]
[]
@@ -141,6 +137,7 @@ type Msg
= SubmittedForm
| EnteredEmail String
| EnteredPassword String
| EnteredUsername String
| CompletedRegister (Result Http.Error Viewer)
| GotSession Session
@@ -154,6 +151,9 @@ update msg model =
EnteredPassword password ->
updateForm (\form -> { form | password = password }) model
EnteredUsername username ->
updateForm (\form -> { form | username = username }) model
SubmittedForm ->
case validate model.form of
Ok validForm ->