Skip to content

Commit 7c22a49

Browse files
committed
Fix queue match payload typing for production web build
1 parent 5485bb3 commit 7c22a49

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

web/src/pages/landing/LandingPage.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ function fallbackOpponentName(matchedWith: MatchedWith): string {
7070
return matchedWith === "human" ? "rival humano" : "bot rival";
7171
}
7272

73-
function saveMatchedGame(gameId: string, matchedWith: MatchedWith): void {
73+
function saveMatchedGame(gameId: string, matchedWith: MatchedWith, opponentUsername: string | null): void {
7474
const payload: QueueMatch = {
7575
gameId,
7676
matchedWith,
77+
opponentUsername,
7778
createdAt: Date.now(),
7879
source: "queue",
7980
};
@@ -470,12 +471,12 @@ export function LandingPage(): JSX.Element {
470471
if (accessToken !== null) {
471472
const decision = await acceptMatchedQueue(accessToken);
472473
if (decision.game_id !== null) {
473-
saveMatchedGame(decision.game_id, pendingMatch.matchedWith);
474+
saveMatchedGame(decision.game_id, pendingMatch.matchedWith, pendingMatch.opponentUsername);
474475
} else {
475-
saveMatchedGame(pendingMatch.gameId, pendingMatch.matchedWith);
476+
saveMatchedGame(pendingMatch.gameId, pendingMatch.matchedWith, pendingMatch.opponentUsername);
476477
}
477478
} else {
478-
saveMatchedGame(pendingMatch.gameId, pendingMatch.matchedWith);
479+
saveMatchedGame(pendingMatch.gameId, pendingMatch.matchedWith, pendingMatch.opponentUsername);
479480
}
480481
setPendingMatch(null);
481482
navigate("/match?queue=1", {

0 commit comments

Comments
 (0)