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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user