From 0a62eb75821e11bd92c73e6ef46fcc771566fcf7 Mon Sep 17 00:00:00 2001
From: Lucas Morgan
- Search -
++ Search +
+diff --git a/Shogi.UI/Pages/Play/GameBoard/GameBoard.razor b/Shogi.UI/Pages/Play/GameBoard/GameBoard.razor index 1b313eb..1724e1b 100644 --- a/Shogi.UI/Pages/Play/GameBoard/GameBoard.razor +++ b/Shogi.UI/Pages/Play/GameBoard/GameBoard.razor @@ -56,9 +56,16 @@ else if (this.session != null) { var state = await authenticationState; - var accountId = state.User.Claims.First(c => c.Type == ClaimTypes.Name).Value; - this.perspective = accountId == session.Player1 ? WhichPlayer.Player1 : WhichPlayer.Player2; - this.isSpectating = !(accountId == this.session.Player1 || accountId == this.session.Player2); + var accountId = state.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value; + if (accountId == null) + { + this.isSpectating = true; + } + else + { + this.perspective = accountId == session.Player1 ? WhichPlayer.Player1 : WhichPlayer.Player2; + this.isSpectating = !(accountId == this.session.Player1 || accountId == this.session.Player2); + } } StateHasChanged(); } diff --git a/Shogi.UI/Pages/Play/GameBoard/GameBoardPresentation.razor b/Shogi.UI/Pages/Play/GameBoard/GameBoardPresentation.razor index a7c180a..8dbd0b0 100644 --- a/Shogi.UI/Pages/Play/GameBoard/GameBoardPresentation.razor +++ b/Shogi.UI/Pages/Play/GameBoard/GameBoardPresentation.razor @@ -74,9 +74,11 @@
An error occurred.
- - - } - else - { -Do you wish to delete this session?
- - - - } -An error occurred.
+ + + } + else + { +Do you wish to delete this session?
+ + + + } +