Skip to content

Instantly share code, notes, and snippets.

@glinesbdev

glinesbdev/Main.elm

Last active May 1, 2019
Embed
What would you like to do?
Cmd.batch Example
type Msg
= UrlRequested Browser.UrlRequest
| UrlChanged Url.Url
| NameEntered String
| NameSubmitted
| MessageEntered String
| MessageSubmitted
| GenerateRandomId String
generateRandomChatId : Cmd Msg
generateRandomChatId =
Random.generate GenerateRandomId <| RandomString.string 10 RandomChar.latin
NameSubmitted ->
( { model
| route = authRoute (canEnterChat model) Chat
, chatName =
clearChatName
(authRoute (canEnterChat model) Chat)
(String.trim model.chatName)
, errors = formErrors <| canEnterChat model
}
, Cmd.batch
[ generateRandomChatId
, authChangeUrl (canEnterChat model) model.key chatPath
]
)
GenerateRandomId id ->
( { model | chatterId = String.concat [ model.chatName, "-", id ] }
, Cmd.none
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.