Add header for game list (#3)

Co-authored-by: Maxime Adler <madler@sqli.com>
Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2025-02-27 01:09:05 +01:00
parent d9ae2f39bb
commit 4183b4b616
28 changed files with 697 additions and 104 deletions

View File

@@ -1,24 +1,6 @@
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
public partial class GamesBase ()
{
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);
}
}
}