Add entity framework (#11)
Co-authored-by: Maxime Adler <madler@sqli.com> Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
@@ -29,15 +29,20 @@ builder.Services.AddSingleton<Translations>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var client = app.Services.GetService<IHttpClientFactory>()?.CreateClient("GameIdeas.WebAPI") ??
|
||||
throw new Exception("Http client not found");
|
||||
var response = await client.GetAsync("api/Translations");
|
||||
var dictionary = await response.Content.ReadFromJsonAsync<Dictionary<string, string>>();
|
||||
await FetchTranslation(app);
|
||||
|
||||
if (dictionary != null)
|
||||
await app.RunAsync();
|
||||
|
||||
static async Task FetchTranslation(WebAssemblyHost app)
|
||||
{
|
||||
app.Services.GetService<TranslationService>()!.Initialize(dictionary);
|
||||
ResourcesKey.Initialize(app.Services.GetService<Translations>()!);
|
||||
}
|
||||
var client = app.Services.GetService<IHttpClientFactory>()?.CreateClient("GameIdeas.WebAPI") ??
|
||||
throw new Exception("Http client not found");
|
||||
var response = await client.GetAsync("api/Translations");
|
||||
var dictionary = await response.Content.ReadFromJsonAsync<Dictionary<string, string>>();
|
||||
|
||||
await app.RunAsync();
|
||||
if (dictionary != null)
|
||||
{
|
||||
app.Services.GetService<TranslationService>()!.Initialize(dictionary);
|
||||
ResourcesKey.Initialize(app.Services.GetService<Translations>()!);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user