- AlbumService: CRUD operations for albums via API - PersonService: GetAllAsync for person dropdown - Register both as Scoped in DI
41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
using Blazored.LocalStorage;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
using MilkStream.Client;
|
|
using MilkStream.Client.Components;
|
|
using MilkStream.Client.Services;
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
builder.RootComponents.Add<App>("#app");
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
// Configure ServiceOptions from client-side appsettings.json (wwwroot/appsettings.json).
|
|
builder.Services.Configure<ServiceOptions>(options => {
|
|
options.BaseUrl = builder.Configuration["BaseUrl"] ?? string.Empty;
|
|
});
|
|
|
|
// Default (unauthenticated) HttpClient used by LoginService.
|
|
builder.Services.AddHttpClient();
|
|
|
|
// Named client with the JWT token-refresh DelegatingHandler for authenticated services.
|
|
builder.Services.AddHttpClient("MilkstreamClient")
|
|
.AddHttpMessageHandler<JwtTokenRefresher>();
|
|
|
|
// Register the token-refresh handler and all application services.
|
|
builder.Services.AddScoped<JwtTokenRefresher>();
|
|
builder.Services.AddSingleton<LoginService>();
|
|
builder.Services.AddScoped<MediaService>();
|
|
builder.Services.AddScoped<AssetService>();
|
|
builder.Services.AddScoped<UserService>();
|
|
builder.Services.AddScoped<SettingsService>();
|
|
builder.Services.AddScoped<FoldersService>();
|
|
builder.Services.AddScoped<JobsService>();
|
|
builder.Services.AddScoped<StatsService>();
|
|
builder.Services.AddScoped<AlbumService>();
|
|
builder.Services.AddScoped<PersonService>();
|
|
|
|
// Browser local storage (replaces server-side ProtectedLocalStorage).
|
|
builder.Services.AddBlazoredLocalStorage();
|
|
|
|
await builder.Build().RunAsync();
|