summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJomar Milan <jomarm@jomarm.com>2026-06-10 15:25:11 -0700
committerJomar Milan <jomarm@jomarm.com>2026-06-10 15:25:11 -0700
commitc5f26f816dbd18f2dcd65bb8c8965183c4ae853d (patch)
tree2e6114b692f927b6b49fa4a0ef1f054c72acbc70 /src/main.rs
parent067e9602ba4feccf947a138c9e73462c446268bc (diff)
Add syncing of color list to browser
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs
index 7162402..e43a337 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,8 +2,8 @@ mod play;
mod session;
mod template;
-use crate::play::handle_play;
-use crate::session::{HandObject, PlayUpdate, Seat, Session};
+use crate::play::{PlayUpdate, handle_play};
+use crate::session::{HandObject, Session};
use crate::template::{IndexTemplate, SessionTemplate};
use askama::Template;
use axum::extract::{Path, Query, State, WebSocketUpgrade};
@@ -125,15 +125,9 @@ async fn update_hands(
Some(session) => {
let mut session = session.lock().unwrap();
- for (color, hand) in payload {
- let seat = session
- .seats
- .entry(color.to_owned())
- .or_insert_with(|| Seat { hand: Vec::new() });
+ session.seats = payload.to_owned();
+ let _ = session.update_tx.send(PlayUpdate::HandUpdate(payload));
- seat.hand = hand.to_owned();
- let _ = session.update_tx.send(PlayUpdate::HandUpdate(color, hand));
- }
StatusCode::NO_CONTENT
}
None => StatusCode::NOT_FOUND,