add some debug info
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using DiunaBI.UI.Shared.Services;
|
||||
using DiunaBI.UI.Shared.Handlers;
|
||||
|
||||
namespace DiunaBI.UI.Shared.Extensions;
|
||||
|
||||
@@ -7,10 +8,23 @@ public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddSharedServices(this IServiceCollection services, string apiBaseUrl)
|
||||
{
|
||||
// HttpClient for API calls
|
||||
// HttpClient for API calls with logging
|
||||
// Ensure BaseAddress ends with / for proper relative URL resolution
|
||||
var baseUri = apiBaseUrl.EndsWith('/') ? apiBaseUrl : apiBaseUrl + "/";
|
||||
services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(baseUri) });
|
||||
|
||||
services.AddTransient<HttpLoggingHandler>();
|
||||
|
||||
services.AddHttpClient<AuthService>(client =>
|
||||
{
|
||||
client.BaseAddress = new Uri(baseUri);
|
||||
})
|
||||
.AddHttpMessageHandler<HttpLoggingHandler>();
|
||||
|
||||
services.AddHttpClient<LayerService>(client =>
|
||||
{
|
||||
client.BaseAddress = new Uri(baseUri);
|
||||
})
|
||||
.AddHttpMessageHandler<HttpLoggingHandler>();
|
||||
|
||||
// Services
|
||||
services.AddScoped<AuthService>();
|
||||
|
||||
Reference in New Issue
Block a user