M client/src/plugins/async_tasks/req_game_forming.rs => client/src/plugins/async_tasks/req_game_forming.rs +3 -2
@@ 21,7 21,7 @@ pub struct GameFormingCall(Task<FormingResponse>);
#[derive(Clone)]
pub struct GameFormingCallEvent;
-async_task_start_call!(GameFormingCallEvent, GameFormingCall, |ev, no| {
+async_task_start_call!(GameFormingCallEvent, GameFormingCall, |_ev, no| {
let res = api::game::forming(&mut no);
res
@@ 31,7 31,8 @@ async_task_handle_call!(GameFormingCall, |response, menu_data| {
match response {
Err(_err) => panic!("forming games failed, handle me"),
Ok(resp) => {
- // save to a menu data field
+ menu_data.waiting = false;
+ menu_data.forming_games = resp;
}
}
});
M client/src/plugins/async_tasks/req_game_mygames.rs => client/src/plugins/async_tasks/req_game_mygames.rs +3 -2
@@ 21,7 21,7 @@ pub struct GameMyGamesCall(Task<MyGamesResponse>);
#[derive(Clone)]
pub struct GameMyGamesCallEvent;
-async_task_start_call!(GameMyGamesCallEvent, GameMyGamesCall, |ev, no| {
+async_task_start_call!(GameMyGamesCallEvent, GameMyGamesCall, |_ev, no| {
let res = api::game::my_games(&mut no);
res
@@ 31,7 31,8 @@ async_task_handle_call!(GameMyGamesCall, |response, menu_data| {
match response {
Err(_err) => panic!("my games failed, handle me"),
Ok(resp) => {
- // save to a menu data field
+ menu_data.waiting = false;
+ menu_data.my_games = resp;
}
}
});
M => +7 -1
@@ 8,7 8,7 @@
use bevy::prelude::*;
use crate::AppState;
use crate::{AppState, api::game::Game};
mod ui;
@@ 38,6 38,9 @@ pub struct MenuData {
/// true if waiting on some request
pub waiting: bool,
pub forming_games: Vec<Game>,
pub my_games: Vec<Game>,
error: String,
login_email: String,
@@ 57,6 60,9 @@ impl Default for MenuData {
waiting: false,
forming_games: vec![],
my_games: vec![],
error: String::from(""),
login_email: String::from(""),