๐Ÿ‘ฉโ€๐Ÿš’ Firefighters API written in Gleam!
lustre gleam

:lipstick: display error message when passwords dont match

kacaii.dev 9aa3ffbc a606cf2c

verified
+26 -17
+24 -15
client/src/client/page/signup.gleam
··· 65 65 ) 66 66 67 67 UserSelectedRole(value) -> { 68 - let role = role.from_string(value) 69 - #(Model(..model, user_role: role), effect.none()) 68 + let user_role = role.from_string(value) 69 + #(Model(..model, user_role:), effect.none()) 70 70 } 71 71 72 - UserUpdatedPasswordField(value) -> #( 73 - Model(..model, user_password: value), 74 - effect.none(), 75 - ) 72 + UserUpdatedPasswordField(user_password) -> { 73 + let text_message = case user_password == model.user_confirm_password { 74 + True -> "" 75 + False -> "Passwords must match" 76 + } 76 77 77 - UserUpdatedConfirmPasswordField(value) -> #( 78 - Model(..model, user_confirm_password: value), 79 - effect.none(), 80 - ) 78 + #(Model(..model, text_message:, user_password:), effect.none()) 79 + } 80 + 81 + UserUpdatedConfirmPasswordField(user_confirm_password) -> { 82 + let text_message = case user_confirm_password == model.user_password { 83 + True -> "" 84 + False -> "Passwords must match" 85 + } 86 + 87 + #(Model(..model, text_message:, user_confirm_password:), effect.none()) 88 + } 81 89 82 90 UserSentRequest -> { 83 91 todo as "build and send request" ··· 104 112 fn text_message(model: Model) -> element.Element(Msg) { 105 113 case model.text_message { 106 114 "" -> element.none() 107 - text -> html.p([], [html.text(text)]) 115 + text -> html.p([class("text-white")], [html.text(text)]) 108 116 } 109 117 } 110 118 ··· 187 195 event.on_input(UserSelectedRole), 188 196 ] 189 197 190 - html.select( 191 - attributes, 192 - list.map(role.all, fn(role) { html.option([], role.to_string(role)) }), 193 - ) 198 + let role_to_option = fn(role: role.Role) { 199 + html.option([attr.selected(model.user_role == role)], role.to_string(role)) 200 + } 201 + 202 + html.select(attributes, list.map(role.all, role_to_option)) 194 203 } 195 204 196 205 fn text_input(
+2 -2
justfile
··· 44 44 45 45 # Start the pod 46 46 [group("podman")] 47 - start: 47 + start: 48 48 podman pod start {{ pod_name }} 49 49 50 50 # Stop pod ··· 57 57 clean: 58 58 podman pod rm -f {{ pod_name }} 59 59 60 - [private] 60 + [group("podman")] 61 61 @init-database: create-pod 62 62 podman run --rm -d --name postgres-database --pod {{ pod_name }} --replace {{ pg_env }} \ 63 63 {{ pg_health_cmd }} {{ pg_health_conf }} {{ pg_health_start_period }} \