Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
fitztrev committed Jan 13, 2024
1 parent 62823bf commit cb8417c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,8 @@ export default {
checkForTrophy(game: Game, name: string, results: TrophyCheckResult, onMoveNumber?: number): void {
for (const result of results) {
if (
(result.color === 'w' && game.players.white.username.toLowerCase() === this.username) ||
(result.color === 'b' && game.players.black.username.toLowerCase() === this.username)
(result.color === 'w' && game.players.white.username?.toLowerCase() === this.username) ||
(result.color === 'b' && game.players.black.username?.toLowerCase() === this.username)
) {
this.addTrophyForPlayer(name, game, result.onMoveNumber || onMoveNumber || 0)
}
Expand All @@ -1049,7 +1049,7 @@ export default {
let opponent
let link
if (game.players.white.username.toLowerCase() === this.username) {
if (game.players.white.username?.toLowerCase() === this.username) {
opponent = game.players.black
link = game.links.white
} else {
Expand All @@ -1063,6 +1063,10 @@ export default {
link += onMoveNumber - 1
}
if (!opponent.username) {
return
}
this.playerTrophiesByType[trophyName][game.id] = {
date: new Date(game.timestamp).toISOString().split('T')[0], // YYYY-MM-DD format
opponent: {
Expand Down

0 comments on commit cb8417c

Please sign in to comment.