fix: go to url when game found
This commit is contained in:
@ -19,7 +19,7 @@ export default class extends AbstractAuthentifiedView {
|
||||
{
|
||||
let nb_players = document.getElementById("nb_players-input").value
|
||||
|
||||
await client.matchmaking.start(this.display_data, this.ondisconnect, nb_players);
|
||||
await client.matchmaking.start(this.onreceive.bind(this), this.ondisconnect.bind(this), nb_players);
|
||||
|
||||
document.getElementById("button").value = "Stop matchmaking"
|
||||
}
|
||||
@ -30,6 +30,16 @@ export default class extends AbstractAuthentifiedView {
|
||||
document.getElementById("button").value = "Find a game"
|
||||
}
|
||||
|
||||
onreceive(data)
|
||||
{
|
||||
if (data.detail === "game_found")
|
||||
{
|
||||
navigateTo(`/games/${data.game_id}`);
|
||||
return;
|
||||
}
|
||||
this.display_data(data)
|
||||
}
|
||||
|
||||
display_data(data)
|
||||
{
|
||||
clear("innerText", ["detail"]);
|
||||
|
Reference in New Issue
Block a user