Send new move to the server.
This commit is contained in:
parent
b52b16e5df
commit
0283e060e4
2
Go.elm
2
Go.elm
|
@ -32,7 +32,7 @@ update : Msg -> Model -> (Model, Cmd Msg)
|
||||||
update msg model = case msg of
|
update msg model = case msg of
|
||||||
Place c -> case verify c model of
|
Place c -> case verify c model of
|
||||||
Nothing -> ( { model | error = Just "Can't place piece" }, Cmd.none)
|
Nothing -> ( { model | error = Just "Can't place piece" }, Cmd.none)
|
||||||
Just c -> ( { model | board = c::model.board }, Cmd.none)
|
Just c -> ( { model | board = c::model.board }, sendMove model c)
|
||||||
Update s -> case decodeUpdatestring s of
|
Update s -> case decodeUpdatestring s of
|
||||||
Ok (c, xs) -> ( { model | board = xs, currentColor = Just c }, Cmd.none)
|
Ok (c, xs) -> ( { model | board = xs, currentColor = Just c }, Cmd.none)
|
||||||
Err s -> ( { model | error = Just "Can't parse server response" }, Cmd.none)
|
Err s -> ( { model | error = Just "Can't parse server response" }, Cmd.none)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user