Skip to content

Commit

Permalink
fix: new game request
Browse files Browse the repository at this point in the history
  • Loading branch information
yHSJ committed Nov 26, 2024
1 parent de6e453 commit 5b7ccdc
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions crates/rpc/src/routes/new_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,19 @@ pub async fn new_game(address: &str, state: &State<ClusterState>) -> Result<Json
.unwrap_or_default();

let url = local_url + "/game/new_game?address=" + address;
println!("{}", url);
let response = reqwest::get(url)
.await
.context("failed to hit new_game metrics server endpoint")?;

println!(
"respons status {:?} | body: {:?}",
response.status(),
response.json::<Value>().await
);

// let body = response
// .json::<NewGameLocalResponse>()
// .await
// .context("http error")?;
let body = response
.json::<NewGameLocalResponse>()
.await
.context("http error")?;

Ok(Json(NewGameResponse {
game_id: node_id,
ip: external_url,
player_state: "".to_string(),
admin_pkh: "".to_string(),
player_state: body.player_state,
admin_pkh: body.admin_pkh,
}))
}

0 comments on commit 5b7ccdc

Please sign in to comment.