Domain can be deleted - with automatic update of the own domain list.

beta
Philippe Pittoli 2023-07-03 12:17:44 +02:00
parent 99fb18c57a
commit 62347d40b2
2 changed files with 12 additions and 1 deletions

View File

@ -12,7 +12,7 @@ module App.DNSManagerDomainsInterface where
Authentication is automatic with the token.
-}
import Prelude (Unit, Void, bind, discard, map, otherwise, show, void, when, ($), (&&), (<$>), (<<<), (<>), (>>=))
import Prelude (Unit, Void, bind, discard, map, otherwise, show, void, when, ($), (&&), (<$>), (<<<), (<>), (>>=), (/=))
import Bulma as Bulma
@ -378,6 +378,11 @@ handleAction = case _ of
(DNSManager.MkInvalidDomainName _) -> do
appendMessage $ "[😈] Failed! The domain is not valid!"
(DNSManager.MkDomainDeleted response) -> do
{ my_domains } <- H.get
appendMessage $ "[😈] The domain '" <> response.domain <> "' has been deleted!"
handleAction $ UpdateMyDomains $ A.filter ((/=) response.domain) my_domains
(DNSManager.MkSuccess _) -> do
appendMessage $ "[😈] Success!"
-- WTH?!

View File

@ -129,6 +129,10 @@ type InvalidDomainName = { }
codecInvalidDomainName :: CA.JsonCodec InvalidDomainName
codecInvalidDomainName = CA.object "InvalidDomainName" (CAR.record { })
{- 9 -}
type DomainDeleted = { domain :: String }
codecDomainDeleted :: CA.JsonCodec DomainDeleted
codecDomainDeleted = CA.object "DomainDeleted" (CAR.record { domain: CA.string })
{- 10 -}
-- For now, Error is just an alias on String.
@ -209,6 +213,7 @@ data AnswerMessage
| MkRRNotFound RRNotFound -- 6
| MkUnacceptableDomain UnacceptableDomain -- 7
| MkInvalidDomainName InvalidDomainName -- 8
| MkDomainDeleted DomainDeleted -- 9
| MkInvalidZone InvalidZone -- 10
| MkDomainChanged DomainChanged -- 11
| MkZone Zone -- 12
@ -254,6 +259,7 @@ decode number string
6 -> error_management codecRRNotFound MkRRNotFound
7 -> error_management codecUnacceptableDomain MkUnacceptableDomain
8 -> error_management codecInvalidDomainName MkInvalidDomainName
9 -> error_management codecDomainDeleted MkDomainDeleted
10 -> error_management codecInvalidZone MkInvalidZone
11 -> error_management codecDomainChanged MkDomainChanged
12 -> error_management codecZone MkZone