Skip to content

Commit

Permalink
Add CreateChannel Msg
Browse files Browse the repository at this point in the history
  • Loading branch information
heejongahn committed Nov 21, 2016
1 parent 3663b9d commit 7edc5b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/src/app.elm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ getCurrentChannel model =
-- Update
type Msg = SendLine
| Typing String
| CreateChannel String
| ChangeChannel String
| Noop

Expand All @@ -74,6 +75,10 @@ update msg model =
)
Typing msg ->
(updateCurrentChannel model { currentChannel | typing = msg }, Cmd.none)
CreateChannel name ->
if D.member name model.channels
then ( model, Cmd.none ) {- Error notification logic should be added -}
else ( { model | channels = (D.insert name (Channel currentChannel.nick [] "") model.channels) }, Cmd.none )
ChangeChannel name ->
( { model | currentName = name }, Task.attempt (\_ -> Noop) (toBottom "logs") )
Noop -> ( model, Cmd.none )
Expand Down

0 comments on commit 7edc5b0

Please sign in to comment.