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"); builder.RootComponents.Add("head::after"); builder.Services.AddBlazorBootstrap(); //Auth + HTTP Config builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddHttpClient(client => { client.BaseAddress = new Uri("https://localhost:7271/"); }).AddHttpMessageHandler(); builder.Services.AddHttpClient(client => { client.BaseAddress = new Uri("https://localhost:7271/"); }).AddHttpMessageHandler(); builder.Services.AddHttpClient(client => { client.BaseAddress = new Uri("https://localhost:7271/"); }).AddHttpMessageHandler(); builder.Services.AddHttpClient(client => { client.BaseAddress = new Uri("https://localhost:7271/"); }).AddHttpMessageHandler(); 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(); await builder.Build().RunAsync();*/