File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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" , {
You can’t perform that action at this time.
0 commit comments