* Changed views to have them in the same layout

* Added Authorization
This commit is contained in:
2025-02-28 13:33:01 +01:00
parent aedb5810c2
commit b8fbb789ad
35 changed files with 1605 additions and 1306 deletions

View File

@@ -2,16 +2,16 @@
@attribute [Authorize]
@using System.Security.Claims
@using Microsoft.AspNetCore.Authorization
@using OrdersManagement.Components.Pages.Shared
@using Syncfusion.Blazor.Grids
@inject ScheduleOrderService ScheduleOrderService
@inject CustomAuthenticationStateProvider CustomAuthenticationStateProvider
@inject NavigationManager NavigationManager;
<div class="h-100 d-flex flex-column">
<h5>Zamówienia DELFOR</h5>
<ScheduleOrdersGrid PageSize="20" PassGridRef="SetGridRef" GridData="_scheduleOrders" />
</div>
<ScheduleOrdersGrid PageSize="20" PassGridRef="SetGridRef" GridData="_scheduleOrders" />
@code {
private IEnumerable<ScheduleOrderDto> _scheduleOrders = [];
@@ -20,8 +20,17 @@
{
if (firstRender)
{
_scheduleOrders = await FetchScheduleOrdersAsync();
StateHasChanged();
ClaimsPrincipal currentUser = CustomAuthenticationStateProvider.GetCurrentUser();
if (currentUser.Identity?.IsAuthenticated == false)
{
NavigationManager.NavigateTo("/Unauthorized");
}
else
{
_scheduleOrders = await FetchScheduleOrdersAsync();
StateHasChanged();
}
}
}