Files
TekH e36f816f35 Add Receiver API client, auth state, and localization services
Introduced HttpClient for ReceiverApiClient to enable BFF-proxied API calls with authentication cookie forwarding. Registered LocalizationService and ReceiverAuthState as scoped services for localization and authentication state management. Updated using statements to support these additions. Added explanatory comments for the new setup.
2026-05-13 22:43:22 +02:00

32 lines
1.2 KiB
C#

using EnvelopeGenerator.ReceiverUI.Web.Client.Api;
using EnvelopeGenerator.ReceiverUI.Web.Client.Services;
using EnvelopeGenerator.ReceiverUI.Web.Client.Utils;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddDevExpressBlazor(options =>
{
options.SizeMode = DevExpress.Blazor.SizeMode.Medium;
});
builder.Services.AddChatClient(builder.HostEnvironment.BaseAddress + "api/chat", "proxykey", "proxychat");
builder.Services.AddDevExpressWebAssemblyBlazorPdfViewer();
DevExpress.XtraPrinting.PrintingOptions.Pdf.RenderingEngine = DevExpress.XtraPrinting.XRPdfRenderingEngine.Skia;
// ── Receiver API + Auth + Localization ─────────────────────────────
// Same-origin HttpClient: the BFF (EnvelopeGenerator.ReceiverUI.Web)
// reverse-proxies /api/** to EnvelopeGenerator.API and forwards the
// HttpOnly authentication cookie automatically.
builder.Services.AddHttpClient<ReceiverApiClient>(client =>
{
client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress);
});
builder.Services.AddScoped<LocalizationService>();
builder.Services.AddScoped<ReceiverAuthState>();
await builder.Build().RunAsync();