AuthForm: WS disconnection on successful authentication.

master
Philippe Pittoli 9 months ago
parent e44b1aebe9
commit 7804dd6647

@ -141,6 +141,7 @@ data Action
| HandleLoginInputUpdate String
| HandlePassInputUpdate String
| AuthenticationAttempt Event
| Finalize
| HandleWebSocket (WebSocketEvent WebSocketMessageType)
type State =
@ -161,6 +162,7 @@ component =
, eval: H.mkEval $ H.defaultEval
{ initialize = Just Initialize
, handleAction = handleAction
, finalize = Just Finalize
}
}
@ -259,6 +261,13 @@ handleAction = case _ of
Initialize ->
handleAction ConnectWebSocket
Finalize -> do
{ wsConnection } <- H.get
systemMessage "Finalize"
case wsConnection of
Nothing -> systemMessage "No socket? How is that even possible?"
Just socket -> H.liftEffect $ WS.close socket
WebSocketParseError error ->
systemMessage $ renderError (UnknownError error)

Loading…
Cancel
Save