From 7804dd6647a9a8f8f62ad09a1d38c47d5b7fb7ef Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Fri, 2 Jun 2023 00:53:01 +0200 Subject: [PATCH] AuthForm: WS disconnection on successful authentication. --- src/App/AuthenticationForm.purs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/App/AuthenticationForm.purs b/src/App/AuthenticationForm.purs index 0c96fe1..7a132c1 100644 --- a/src/App/AuthenticationForm.purs +++ b/src/App/AuthenticationForm.purs @@ -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)