another fix
This commit is contained in:
@@ -8,7 +8,9 @@ public static class ServiceCollectionExtensions
|
||||
public static IServiceCollection AddSharedServices(this IServiceCollection services, string apiBaseUrl)
|
||||
{
|
||||
// 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.AddScoped<AuthService>();
|
||||
|
||||
@@ -14,8 +14,6 @@ var apiBaseUrl = builder.Configuration["ApiSettings:BaseUrl"]
|
||||
?? throw new InvalidOperationException("ApiSettings:BaseUrl is not configured");
|
||||
builder.Services.AddSharedServices(apiBaseUrl);
|
||||
|
||||
builder.Services.AddScoped<AuthService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
|
||||
Reference in New Issue
Block a user