-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (26 loc) · 1.13 KB
/
Program.cs
File metadata and controls
36 lines (26 loc) · 1.13 KB
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
using Blazored.LocalStorage;
using Example;
using Example.Options;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;
using PocketBaseSharp;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// Make the loaded config available via dependency injection
builder.Services.AddSingleton<IConfiguration>(builder.Configuration);
var pbConfigurationSection = builder.Configuration.GetSection(PocketBaseOptions.Position);
builder.Services.Configure<PocketBaseOptions>(pbConfigurationSection);
var pbOptions = pbConfigurationSection.Get<PocketBaseOptions>();
builder.Services.AddSingleton<PocketBase>(sp =>
{
return new PocketBase(pbOptions.BaseUrl);
});
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddMudServices();
//Authentication
builder.Services.AddScoped<AuthenticationStateProvider, PocketBaseAuthenticationStateProvider>();
builder.Services.AddAuthorizationCore();
await builder.Build().RunAsync();