diff --git a/src/front/static/ts/main.ts b/src/front/static/ts/main.ts index f3005fe..b18641f 100644 --- a/src/front/static/ts/main.ts +++ b/src/front/static/ts/main.ts @@ -35,7 +35,7 @@ const routes = [ { path: "/tetris", view: () => import("./views/TetrisMenu.ts") }, { path: "/tetris/solo", view: () => import("./views/Tetris.ts") }, - { path: "/tetris/versus", view: () => import("./views/Tetris.ts") }, + { path: "/tetris/versus", view: () => import("./views/TetrisVersus.ts") }, { path: "/login", view: () => import("./views/LoginPage.ts") }, { path: "/register", view: () => import("./views/RegisterPage.ts") }, diff --git a/src/front/static/ts/views/Game.ts b/src/front/static/ts/views/Game.ts index 5e29d7b..07d72b8 100644 --- a/src/front/static/ts/views/Game.ts +++ b/src/front/static/ts/views/Game.ts @@ -147,18 +147,19 @@ export default class extends Aview { if (await isLogged()) { let uuid = document.cookie.match(new RegExp('(^| )' + "uuid" + '=([^;]+)'))[2]; - fetch(`http://localhost:3002/users/${uuid}/matchHistory`, { + fetch(`http://localhost:3002/users/${uuid}/matchHistory?game=pong`, { method: "POST", headers: { "Content-Type": "application/json", }, credentials: "include", - body: JSON.stringify({ "opponent": p2_name, "myScore": p1_score, "opponentScore": p2_score }) + body: JSON.stringify({ + "game": "pong", + "opponent": p2_name, + "myScore": p1_score, + "opponentScore": p2_score, + "date": Date.now(), + }), }); } - // ------------------------------------------------------------------------------------------------------------------------------------------ - // - // insert the fetch to the ScoreStore api here - // - // ------------------------------------------------------------------------------------------------------------------------------------------ match_over = true; } else diff --git a/src/front/static/ts/views/LoginPage.ts b/src/front/static/ts/views/LoginPage.ts index 0311473..0ed05c1 100644 --- a/src/front/static/ts/views/LoginPage.ts +++ b/src/front/static/ts/views/LoginPage.ts @@ -1,5 +1,5 @@ import Aview from "./Aview.ts" -import { dragElement } from "./drag.js" +import { dragElement } from "./drag.ts" import { setOnekoState } from "../oneko.ts" import { isLogged, navigationManager } from "../main.ts" @@ -29,11 +29,11 @@ export default class extends Aview {