67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
using OnProfNext.Client;
|
|
using OnProfNext.Client.Services;
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
builder.RootComponents.Add<App>("#app");
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
builder.Services.AddBlazorBootstrap();
|
|
|
|
//Auth + HTTP Config
|
|
|
|
builder.Services.AddScoped<AuthService>();
|
|
builder.Services.AddScoped<AuthorizationMessageHandler>();
|
|
|
|
builder.Services.AddHttpClient<UserApiService>(client =>
|
|
{
|
|
client.BaseAddress = new Uri("https://localhost:7271/");
|
|
}).AddHttpMessageHandler<AuthorizationMessageHandler>();
|
|
|
|
builder.Services.AddHttpClient<ProjectApiService>(client =>
|
|
{
|
|
client.BaseAddress = new Uri("https://localhost:7271/");
|
|
}).AddHttpMessageHandler<AuthorizationMessageHandler>();
|
|
|
|
builder.Services.AddHttpClient<OrderApiService>(client =>
|
|
{
|
|
client.BaseAddress = new Uri("https://localhost:7271/");
|
|
}).AddHttpMessageHandler<AuthorizationMessageHandler>();
|
|
|
|
builder.Services.AddHttpClient<BookingApiService>(client =>
|
|
{
|
|
client.BaseAddress = new Uri("https://localhost:7271/");
|
|
}).AddHttpMessageHandler<AuthorizationMessageHandler>();
|
|
|
|
builder.Services.AddScoped(sp => new HttpClient
|
|
{
|
|
BaseAddress = new Uri("https://localhost:7271/")
|
|
});
|
|
|
|
|
|
|
|
|
|
await builder.Build().RunAsync();
|
|
|
|
|
|
|
|
|
|
|
|
//ALT
|
|
/*builder.Services.AddScoped(sp =>
|
|
{
|
|
var client = new HttpClient { BaseAddress = new Uri("https://localhost:7271/") };
|
|
client.DefaultRequestHeaders.Authorization =
|
|
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer",
|
|
// hier ggf. Token aus localStorage laden
|
|
"");
|
|
return client;
|
|
});
|
|
|
|
builder.Services.AddScoped<UserApiService>();
|
|
|
|
|
|
await builder.Build().RunAsync();*/
|
|
|