File size: 1,265 Bytes
4433399
6f32ae8
 
 
 
4433399
 
 
 
 
 
 
6f32ae8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4433399
d8a7fc4
 
 
4433399
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using BlazorWebAssembly;
using BlazorWebAssembly.Providers;
using BlazorWebAssembly.Services;
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

// Add HttpClient with Backend address
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7028/") });

// Add Blazored LocalStorage
builder.Services.AddBlazoredLocalStorage();

// Add Authorization Core
builder.Services.AddAuthorizationCore();

// Register Custom AuthStateProvider
builder.Services.AddScoped<JwtAuthenticationStateProvider>();
builder.Services.AddScoped<AuthenticationStateProvider>(sp => sp.GetRequiredService<JwtAuthenticationStateProvider>());

// Register AuthService
builder.Services.AddScoped<AuthService>();

// Register ThemeService
builder.Services.AddScoped<ThemeService>();

// Register LibraryApiClient
builder.Services.AddScoped<LibraryApiClient>();

// Register WishlistService
builder.Services.AddScoped<WishlistService>();

await builder.Build().RunAsync();