ddd-refactor #2

Merged
mz merged 46 commits from ddd-refactor into main 2025-11-28 11:14:43 +01:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 5a5b70a5ed - Show all commits

View File

@@ -8,7 +8,9 @@ public static class ServiceCollectionExtensions
public static IServiceCollection AddSharedServices(this IServiceCollection services, string apiBaseUrl) public static IServiceCollection AddSharedServices(this IServiceCollection services, string apiBaseUrl)
{ {
// HttpClient for API calls // HttpClient for API calls
services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(apiBaseUrl) }); // 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 // Services
services.AddScoped<AuthService>(); services.AddScoped<AuthService>();

View File

@@ -14,8 +14,6 @@ var apiBaseUrl = builder.Configuration["ApiSettings:BaseUrl"]
?? throw new InvalidOperationException("ApiSettings:BaseUrl is not configured"); ?? throw new InvalidOperationException("ApiSettings:BaseUrl is not configured");
builder.Services.AddSharedServices(apiBaseUrl); builder.Services.AddSharedServices(apiBaseUrl);
builder.Services.AddScoped<AuthService>();
var app = builder.Build(); var app = builder.Build();
if (!app.Environment.IsDevelopment()) if (!app.Environment.IsDevelopment())