UserAdded: message was correctly parsed after all.
This commit is contained in:
parent
6c69eaea5a
commit
5f13307d86
@ -585,6 +585,8 @@ handleAction = case _ of
|
||||
(AuthD.GotToken msg) -> do
|
||||
appendMessage $ "[😈] Success! user " <> (show msg.uid) <> " has token: " <> msg.token
|
||||
H.raise $ AuthToken msg.token
|
||||
(AuthD.GotUserAdded msg) -> do
|
||||
appendMessage $ "[😈] Success! Server added user: " <> show msg.user
|
||||
-- WTH?!
|
||||
_ -> do
|
||||
appendMessage $ "[😈] Failed! Authentication server didn't send a valid message."
|
||||
|
@ -54,7 +54,7 @@ render state
|
||||
= HH.div_ $
|
||||
[ render_auth_form
|
||||
, div_token
|
||||
, render_original_interface
|
||||
--, render_original_interface
|
||||
--, useless_stuff
|
||||
]
|
||||
where
|
||||
@ -75,13 +75,13 @@ render state
|
||||
[ HP.class_ (H.ClassName "box") ]
|
||||
[ HH.p_ [ HH.text ("Token is: " <> current_token) ] ]
|
||||
|
||||
render_original_interface :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
|
||||
render_original_interface =
|
||||
HH.div
|
||||
[ HP.class_ (H.ClassName "box") ]
|
||||
[ HH.h1_ [ HH.text "Original interface" ]
|
||||
, HH.slot_ _oi unit OI.component "ws://127.0.0.1:8080"
|
||||
]
|
||||
--render_original_interface :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
|
||||
--render_original_interface =
|
||||
-- HH.div
|
||||
-- [ HP.class_ (H.ClassName "box") ]
|
||||
-- [ HH.h1_ [ HH.text "Original interface" ]
|
||||
-- , HH.slot_ _oi unit OI.component "ws://127.0.0.1:8080"
|
||||
-- ]
|
||||
|
||||
-- useless_stuff :: forall monad. MonadAff monad => H.ComponentHTML Action ChildSlots monad
|
||||
-- useless_stuff =
|
||||
|
@ -10,16 +10,15 @@ import Data.Codec.Argonaut.Record as CAR
|
||||
import Data.Newtype (class Newtype)
|
||||
|
||||
-- | Currently not the real type.
|
||||
-- | Lacks 'profile' and 'date_registration' attributes.
|
||||
-- type UserPublic row = { login :: String, uid :: Int | row }
|
||||
-- TODO: add profile :: JSON any, date_registration :: Maybe Time
|
||||
-- | Lacks 'profile' attribute.
|
||||
-- TODO: add profile :: JSON any
|
||||
type UserPublic = { login :: String, uid :: Int, date_registration :: Maybe String }
|
||||
|
||||
-- | UserPublic.codec can be used to parse and encode public user info,
|
||||
-- | which can be exchanged in different messages.
|
||||
codec :: JsonCodec UserPublic
|
||||
codec = CA.object "UserPublic" (CAR.record { "login": CA.string
|
||||
, "uid": CA.int
|
||||
, "date_registration": CAR.optional CA.string })
|
||||
codec = CA.object "UserPublic" (CAR.record { login: CA.string
|
||||
, uid: CA.int
|
||||
, date_registration: CAR.optional CA.string })
|
||||
|
||||
-- {"user":{"login":"a","uid": 1003,"date_registration":"2023-06-03T03:32:10+02:00"}}
|
||||
|
Loading…
Reference in New Issue
Block a user