@page "/group/{GroupId:guid}/applications" @using GmRelay.Web.Services @using GmRelay.Shared.Domain @using Microsoft.AspNetCore.Authorization @attribute [Authorize] @inject AuthorizedMembershipService MembershipService @inject AuthorizedSessionService SessionService @inject NavigationManager Navigation @inject IHttpContextAccessor HttpContextAccessor @using System.Security.Claims Заявки участников — GM-Relay
@if (accessDenied) {

Нет доступа

Только owner или co-GM группы могут просматривать заявки.

} else if (applications is null) {
} else if (applications.Count == 0) {

Новых заявок нет

Когда игроки подадут заявку на участие в клубе, она появится здесь.

} else { } @if (!string.IsNullOrEmpty(errorMessage)) {
⚠️ @errorMessage
}
@code { [Parameter] public Guid GroupId { get; set; } private List? applications; private bool accessDenied; private string? errorMessage; private Guid? busyMembershipId; protected override async Task OnParametersSetAsync() { accessDenied = false; try { applications = await MembershipService.GetPendingApplicationsAsync(GroupId); } catch (SessionAccessDeniedException) { accessDenied = true; } } private async Task Approve(Guid membershipId) { errorMessage = null; busyMembershipId = membershipId; try { await MembershipService.ApproveForCurrentGmAsync(membershipId); applications = await MembershipService.GetPendingApplicationsAsync(GroupId); } catch (SessionAccessDeniedException) { accessDenied = true; } catch (InvalidOperationException ex) { errorMessage = ex.Message; } finally { busyMembershipId = null; } } private async Task Reject(Guid membershipId) { errorMessage = null; busyMembershipId = membershipId; try { await MembershipService.RejectForCurrentGmAsync(membershipId); applications = await MembershipService.GetPendingApplicationsAsync(GroupId); } catch (SessionAccessDeniedException) { accessDenied = true; } catch (InvalidOperationException ex) { errorMessage = ex.Message; } finally { busyMembershipId = null; } } }