@page "/Printers" @inject HttpClient http @inject IJSRuntime JS @inject DialogService DialogService АИС КартрИКС | Принтеры @if (isPhone) { // } @if (!isPhone) { @* *@ } @if (IsDataLoading) { @for (int i = 0; i < 10; i++) { } } else if (locationItems.Count == 0) { } else { @foreach (var location in locationItems) { @* @foreach (var printer in location) { } *@ } } @code { List locationItems = new(); bool isPhone = false; bool IsDataLoading = true; protected override async Task OnInitializedAsync() { isPhone = await JS.InvokeAsync("getDeviceInfo"); await GetLocations(); IsDataLoading = false; } 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!; } }