refactor message handling to drive state transitions
This commit is contained in:
@@ -42,11 +42,6 @@ impl Context {
|
||||
ewebsock::WsMessage::Text(msg) => {
|
||||
let game_resp: GameResponse = serde_json::from_str(&msg).unwrap();
|
||||
|
||||
if let GameResponse::JoinResponse { username, token } = &game_resp {
|
||||
self.username = username.clone();
|
||||
self.token = token.clone();
|
||||
}
|
||||
|
||||
Some(game_resp)
|
||||
}
|
||||
_ => None,
|
||||
|
||||
Reference in New Issue
Block a user