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.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using EnvelopeGenerator.ReceiverUI.Web.Client.Utils;
|
||||
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);
|
||||
@@ -14,4 +16,16 @@ 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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user