Files
DiunaBI/src/Backend/DiunaBI.UI.Shared/Extensions/ServiceCollectionExtensions.cs

21 lines
707 B
C#
Raw Normal View History

2025-11-06 10:20:00 +01:00
using Microsoft.Extensions.DependencyInjection;
using DiunaBI.UI.Shared.Services;
namespace DiunaBI.UI.Shared.Extensions;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddSharedServices(this IServiceCollection services, string apiBaseUrl)
{
// HttpClient for API calls
2025-11-19 16:57:42 +01:00
// Ensure BaseAddress ends with / for proper relative URL resolution
var baseUri = apiBaseUrl.EndsWith('/') ? apiBaseUrl : apiBaseUrl + "/";
services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(baseUri) });
2025-11-06 10:20:00 +01:00
// Services
services.AddScoped<AuthService>();
services.AddScoped<LayerService>();
2025-11-19 16:57:42 +01:00
2025-11-06 10:20:00 +01:00
return services;
}
}