Fix localhost reference.

This commit is contained in:
2024-08-24 23:52:30 -05:00
parent 51d234d871
commit 484106ca17

View File

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.SignalR.Client;
using Shogi.UI.Identity;
using System.Diagnostics;
namespace Shogi.UI.Shared;
@@ -8,10 +7,16 @@ public class GameHubNode : IAsyncDisposable
{
private readonly HubConnection hubConnection;
public GameHubNode()
public GameHubNode(IConfiguration configuration)
{
var baseUrl = configuration["ShogiApiUrl"];
if (string.IsNullOrWhiteSpace(baseUrl))
{
throw new InvalidOperationException("ShogiApiUrl configuration is missing.");
}
this.hubConnection = new HubConnectionBuilder()
.WithUrl(new Uri("https://localhost:5001/gamehub", UriKind.Absolute), options =>
.WithUrl(new Uri($"{baseUrl}/gamehub", UriKind.Absolute), options =>
{
options.HttpMessageHandlerFactory = handler => new CookieCredentialsMessageHandler { InnerHandler = handler };
options.SkipNegotiation = true;