@page "/Printers" @using CartriX.Web.Pages.PrintersPage.Components @using CartriX.Web.Pages.PrintersPage.Dialog @inject HttpClient http @inject IJSRuntime JS @inject DialogService DialogService @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!; } async Task AddPrinterClick() { var result = await DialogService.OpenAsync("Simple Dialog"); } }