Add cors policy
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using GameIdeas.WebApp;
|
||||
using GameIdeas.BlazorApp;
|
||||
using GameIdeas.Resources;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
|
||||
@@ -6,6 +7,20 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
UriBuilder uriBuilder = new(builder.HostEnvironment.BaseAddress)
|
||||
{
|
||||
Port = 8000
|
||||
};
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
builder.Services.AddHttpClient(
|
||||
"GameIdeas.WebAPI",
|
||||
client =>
|
||||
{
|
||||
client.BaseAddress = uriBuilder.Uri;
|
||||
client.Timeout = TimeSpan.FromMinutes(3);
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton<TranslationService>();
|
||||
builder.Services.AddSingleton<Translations>();
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
Reference in New Issue
Block a user