* Changed views to have them in the same layout
* Added Authorization
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user