Remove unused modals service and display.
This commit is contained in:
@@ -75,9 +75,9 @@ public class AccountManager
|
||||
public async Task<bool> TryLoginSilentAsync()
|
||||
{
|
||||
var platform = await localStorage.GetAccountPlatform();
|
||||
Console.WriteLine($"Try Login Silent - {platform}");
|
||||
if (platform == WhichAccountPlatform.Guest)
|
||||
{
|
||||
Console.WriteLine($"Try Login Silent - {platform}");
|
||||
var response = await shogiApi.GetToken(WhichAccountPlatform.Guest);
|
||||
if (response != null)
|
||||
{
|
||||
@@ -91,6 +91,7 @@ public class AccountManager
|
||||
}
|
||||
else if (platform == WhichAccountPlatform.Microsoft)
|
||||
{
|
||||
Console.WriteLine($"Try Login Silent - {platform}");
|
||||
var state = await authState.GetAuthenticationStateAsync();
|
||||
if (state.User?.Identity?.Name != null)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Shogi.UI.Pages.Home.Api
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
request.SetBrowserRequestCredentials(BrowserRequestCredentials.Include);
|
||||
Console.WriteLine("cookie handler: {0}", request.RequestUri);
|
||||
return base.SendAsync(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,14 @@ namespace Shogi.UI.Pages.Home.Api
|
||||
public const string MsalClientName = "Msal";
|
||||
|
||||
private readonly JsonSerializerOptions serializerOptions;
|
||||
private readonly IHttpClientFactory clientFactory;
|
||||
private readonly AccountState accountState;
|
||||
private readonly HttpClient guestHttpClient;
|
||||
private readonly HttpClient msalHttpClient;
|
||||
|
||||
public ShogiApi(IHttpClientFactory clientFactory, AccountState accountState)
|
||||
{
|
||||
serializerOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web);
|
||||
this.clientFactory = clientFactory;
|
||||
Console.WriteLine("ShogiApi constructor");
|
||||
this.serializerOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web);
|
||||
this.accountState = accountState;
|
||||
this.guestHttpClient = clientFactory.CreateClient(GuestClientName);
|
||||
this.msalHttpClient = clientFactory.CreateClient(MsalClientName);
|
||||
@@ -68,6 +67,7 @@ namespace Shogi.UI.Pages.Home.Api
|
||||
var httpClient = whichAccountPlatform == WhichAccountPlatform.Microsoft
|
||||
? this.msalHttpClient
|
||||
: this.guestHttpClient;
|
||||
|
||||
var response = await httpClient.GetAsync(RelativeUri("User/Token"));
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ namespace Shogi.UI.Pages.Home.Api
|
||||
|
||||
public async Task Move(string sessionName, MovePieceCommand command)
|
||||
{
|
||||
await this.HttpClient.PatchAsync($"Sessions/{sessionName}/Move", JsonContent.Create(command));
|
||||
await this.HttpClient.PatchAsync(RelativeUri($"Sessions/{sessionName}/Move"), JsonContent.Create(command));
|
||||
}
|
||||
|
||||
public async Task<HttpStatusCode> PostSession(string name, bool isPrivate)
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
@using Shogi.Contracts.Types
|
||||
@using System.Net.WebSockets
|
||||
@using System.Text
|
||||
@inject ModalService modalService
|
||||
@inject AccountManager AccountManager
|
||||
@inject AccountState Account
|
||||
|
||||
@*<Modals />*@
|
||||
|
||||
<main class="shogi">
|
||||
@if (welcomeModalIsVisible)
|
||||
|
||||
Reference in New Issue
Block a user