ft_transcendence/frontend/static/js/views/MatchMakingView.js

29 lines
511 B
JavaScript
Raw Normal View History

2023-12-12 06:06:13 -05:00
import { client, navigateTo } from "../index.js";
2023-12-11 07:40:01 -05:00
import AbstractView from "./AbstractView.js";
2023-12-12 06:06:13 -05:00
function game_found(game_id)
{
navigateTo(`/games/${game_id}`)
}
2023-12-11 07:40:01 -05:00
export default class extends AbstractView {
constructor(params) {
super(params, "Dashboard");
}
2023-12-12 06:06:13 -05:00
async postInit()
{
await client.matchmaking.start(game_found)
}
2023-12-11 07:40:01 -05:00
async getHtml() {
return `
<h1>finding<h1>
`;
}
2023-12-12 06:06:13 -05:00
async leavePage()
{
await client.matchmaking.stop();
}
2023-12-11 07:40:01 -05:00
}