Files
CartriX/CartriX.Web/Pages/LocationsPage/LocationPage.razor
T

26 lines
733 B
Plaintext

@page "/location/{LocationId:int}"
@inject HttpClient http
@using CartriX.Web.Pages.LocationsPage.Components
@foreach(var printer in printersItems)
{
<PrinterCard printerItem="printer"/>
}
@code {
[Parameter] public int LocationId { get; set; }
List<Models.Printer.PrinterItemList> printersItems = new();
protected override async Task OnInitializedAsync()
{
await GetPrintersItems();
}
async Task GetPrintersItems()
{
var responce = await http.GetAsync(ApiRoutes.Location.ListPrinters(LocationId));
var json = await responce.Content.ReadAsStringAsync();
printersItems = JsonConvert.DeserializeObject<List<Models.Printer.PrinterItemList>>(json) ?? new();
}
}