Allow unauthorized users to search and spectate.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user