@page "/Printers" @using CartriX.Web.Pages.PrintersPage.Components @inject HttpClient http @inject IJSRuntime JS @if (isPhone) { } @if (!isPhone) { } @foreach (var location in locationItems) { @foreach (var printer in location.Printers) { } } @code { List locationItems = new(); bool isPhone = false; protected override async Task OnInitializedAsync() { isPhone = await JS.InvokeAsync("getDeviceInfo"); await GetLocations(); } async Task GetLocations() { var responce = await http.GetAsync(Shared.Classes.ApiRoutes.Location.List); var json = await responce.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject>(json); locationItems = result!; } }