12345678910111213141516171819202122232425 |
- using Microsoft.AspNetCore.Components.Web;
- using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
- using SimpleWebChat.BlazorWasm;
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
- builder.RootComponents.Add<App>("#app");
- builder.RootComponents.Add<HeadOutlet>("head::after");
- builder.Services.AddScoped(sp =>
- {
- var http = new HttpClient();
- #if DEBUG
- http.BaseAddress = new Uri("https://swc-local-dev.topcl.net");
- #else
- var NavManager = sp.GetService<Microsoft.AspNetCore.Components.NavigationManager>();
- var ba = new Uri($"{NavManager.ToAbsoluteUri("/").GetLeftPart(UriPartial.Scheme | UriPartial.Authority)}");
- http.BaseAddress = ba;
- SimpleWebChat.BlazorWasm.Modules.GlobalModule.BasePath = NavManager.BaseUri;
- #endif
- return http;
- });
- await builder.Build().RunAsync();
|