Removing warnings.

master
Philippe Pittoli 2023-05-22 00:42:44 +02:00
parent df11d8e7aa
commit c94456e8f4
1 changed files with 8 additions and 19 deletions

View File

@ -1,23 +1,21 @@
module App.Messages.AuthenticationDaemon where module App.Messages.AuthenticationDaemon where
import Prelude import Prelude (bind, pure, show, ($))
import Effect (Effect) import Effect (Effect)
import Effect.Console (log)
import Data.Argonaut.Core as J import Data.Argonaut.Core as J
import Data.Codec.Argonaut as CA import Data.Codec.Argonaut as CA
import Data.Maybe import Data.Maybe (Maybe)
import Data.Either import Data.Either (Either(..))
import Data.Codec.Argonaut.Record as CAR import Data.Codec.Argonaut.Record as CAR
import Data.UInt (fromInt, toInt, UInt) import Data.UInt (fromInt, toInt, UInt)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.ArrayBuffer.ArrayBuffer as ArrayBuffer import Data.ArrayBuffer.Types (ArrayBuffer)
import Data.ArrayBuffer.Types (ArrayBuffer, DataView)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Control.Monad.Trans.Class (lift)
import App.IPC as IPC import App.IPC as IPC
@ -142,7 +140,7 @@ decode number json
= case number of = case number of
0 -> error_management codecGotError GotError 0 -> error_management codecGotError GotError
1 -> error_management codecGotToken GotToken 1 -> error_management codecGotToken GotToken
12 -> error_management codec_contacts GotContacts 12 -> error_management codecGotContacts GotContacts
_ -> Left UnknownNumber _ -> Left UnknownNumber
-- 1 type Token = { uid :: Int32, token :: String } -- 1 type Token = { uid :: Int32, token :: String }
-- 2 type User = { user :: ::AuthD::User::Public } -- 2 type User = { user :: ::AuthD::User::Public }
@ -168,8 +166,8 @@ decode number json
codecGotError = CA.object "Error" (CAR.record { reason: CAR.optional CA.string }) codecGotError = CA.object "Error" (CAR.record { reason: CAR.optional CA.string })
codecGotToken ∷ CA.JsonCodec Token codecGotToken ∷ CA.JsonCodec Token
codecGotToken = CA.object "Token" (CAR.record { uid: CA.int, token: CA.string }) codecGotToken = CA.object "Token" (CAR.record { uid: CA.int, token: CA.string })
codec_contacts ∷ CA.JsonCodec Contacts codecGotContacts ∷ CA.JsonCodec Contacts
codec_contacts = CA.object "Contacts" (CAR.record { user: CA.int, email: CAR.optional CA.string, phone: CAR.optional CA.string }) codecGotContacts = CA.object "Contacts" (CAR.record { user: CA.int, email: CAR.optional CA.string, phone: CAR.optional CA.string })
serialize :: RequestMessage -> Effect ArrayBuffer serialize :: RequestMessage -> Effect ArrayBuffer
@ -186,12 +184,3 @@ deserialize arraybuffer
Right (Tuple messageTypeNumber string) -> case (decode (toInt messageTypeNumber) $ J.fromString string) of Right (Tuple messageTypeNumber string) -> case (decode (toInt messageTypeNumber) $ J.fromString string) of
Left parsingError -> Left parsingError Left parsingError -> Left parsingError
Right answerMessage -> Right answerMessage Right answerMessage -> Right answerMessage
-- login_decode ∷ J.Json → Either CA.JsonDecodeError GetToken
-- login_decode = CA.decode codec_login
--
-- example_login_deserialize :: J.Json -> Effect Unit
-- example_login_deserialize serialized_login
-- = case (login_decode serialized_login) of
-- Left err -> log $ show err
-- Right l -> log $ show l