feature/init-game-list-page (#2)

Co-authored-by: Maxime Adler <madler@sqli.com>
Reviewed-on: #2
Co-authored-by: egamorf76 <maxime.adler76@gmail.com>
Co-committed-by: egamorf76 <maxime.adler76@gmail.com>
This commit was merged in pull request #2.
This commit is contained in:
2025-02-20 19:25:09 +01:00
committed by Egamorf
parent 75f086b777
commit 81c8498fc1
61 changed files with 81 additions and 59898 deletions

View File

@@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Components;
using System.Net.Http.Json;
using GameIdeas.Resources;
namespace GameIdeas.BlazorApp.Pages.Games;
public partial class GamesBase (
IHttpClientFactory HttpClientFactory,
TranslationService TranslationService,
Translations Translations) : LayoutComponentBase
{
protected override async Task OnInitializedAsync()
{
var client = HttpClientFactory.CreateClient("GameIdeas.WebAPI");
var response = await client.GetAsync("api/Translations");
var dictionary = await response.Content.ReadFromJsonAsync<Dictionary<string, string>>();
if (dictionary != null)
{
TranslationService.Initialize(dictionary);
ResourcesKey.Initialize(Translations);
}
}
}