Simplify a few things.

master
Philippe Pittoli 2023-05-30 16:42:52 +02:00
parent d668f297dc
commit ea0046783b
1 changed files with 2 additions and 16 deletions

View File

@ -109,30 +109,16 @@ decodeMessageEvent = \msgEvent -> do
---------------------------
data ErrorType
= MessageIsServerAdvertisement String
| UnknownError String
= UnknownError String
| UnknownWebSocketError
renderError :: ErrorType -> String
renderError = case _ of
UnknownError str ->
"Unknown error: " <> str
MessageIsServerAdvertisement str ->
"Received following advertisment from server: " <> str
UnknownWebSocketError ->
"Unknown 'error' event has been fired by WebSocket event listener"
--------------------------------------------------------------------------------
-- `Main` function
--------------------------------------------------------------------------------
main :: Effect Unit
main = do
HA.runHalogenAff do
body <- HA.awaitBody
let url = "ws://localhost:8080"
runUI component url body
--------------------------------------------------------------------------------
-- WebSocket message type
--------------------------------------------------------------------------------
@ -205,7 +191,7 @@ wrapperStyle =
"""
render :: forall m. State -> H.ComponentHTML Action () m
render { messages, loginInputText, passInputText, wsConnection, canReconnect, messageHistoryLength } =
render { messages, loginInputText, passInputText, wsConnection, canReconnect, messageHistoryLength } =
HH.div
[ HP.style wrapperStyle ]
[ HH.h2_ [ HH.text "Authentication!" ]