Add a "." between the subdomain and domain names, only when needed.
This commit is contained in:
parent
02f312b447
commit
850d61678a
@ -24,6 +24,7 @@
|
||||
, "prelude"
|
||||
, "profunctor"
|
||||
, "strings"
|
||||
, "stringutils"
|
||||
, "transformers"
|
||||
, "tuples"
|
||||
, "uint"
|
||||
|
@ -15,6 +15,8 @@ import Prelude
|
||||
|
||||
import Bulma as Bulma
|
||||
|
||||
import Data.String.Utils (endsWith)
|
||||
-- import Data.String.CodeUnits as DSCU
|
||||
import Halogen.HTML.Events as HHE
|
||||
import Control.Monad.Except (runExcept)
|
||||
import Control.Monad.State (class MonadState)
|
||||
@ -344,7 +346,7 @@ handleAction = case _ of
|
||||
H.liftEffect $ Event.preventDefault ev
|
||||
|
||||
{ wsInfo, newDomainForm } <- H.get
|
||||
let new_domain = newDomainForm.new_domain <> newDomainForm.selected_domain
|
||||
let new_domain = build_new_domain newDomainForm.new_domain newDomainForm.selected_domain
|
||||
|
||||
case wsInfo.connection, new_domain of
|
||||
Nothing, _ ->
|
||||
@ -461,6 +463,12 @@ handleAction = case _ of
|
||||
, "]"
|
||||
]
|
||||
|
||||
build_new_domain :: String -> String -> String
|
||||
build_new_domain sub tld
|
||||
| sub == "" = "." <> tld
|
||||
| endsWith "." sub = sub <> tld
|
||||
| otherwise = sub <> "." <> tld
|
||||
|
||||
sendArrayBuffer :: WS.WebSocket -> ArrayBuffer -> Effect Unit
|
||||
sendArrayBuffer = WS.sendArrayBuffer
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user