47 lines
1.2 KiB
Text
47 lines
1.2 KiB
Text
@page "/raidoverview"
|
|
@using Lieb.Data
|
|
@using System.Security.Claims
|
|
@using Lieb.Models
|
|
@using Lieb.Models.GuildWars2.Raid
|
|
@inject RaidService RaidService
|
|
@inject UserService UserService
|
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
|
|
|
|
|
<h3>RaidOverview</h3>
|
|
|
|
|
|
<AuthorizeView Policy="@Constants.Roles.RaidLead">
|
|
<div class="nav-item px-3">
|
|
<NavLink class="nav-link" href="raidedit">
|
|
<span class="oi oi-plus" aria-hidden="true"></span> Add Raid
|
|
</NavLink>
|
|
</div>
|
|
</AuthorizeView>
|
|
|
|
|
|
@foreach (var raid in _raids) {
|
|
<br />
|
|
<RaidDetails _raid=@raid _user=@_user/>
|
|
}
|
|
|
|
|
|
|
|
@code
|
|
{
|
|
private List<Raid> _raids;
|
|
private LiebUser? _user;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
|
|
|
if (authState.User.Identity.IsAuthenticated)
|
|
{
|
|
ulong discordId = ulong.Parse(authState.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value);
|
|
_user = UserService.GetLiebUserSmall(discordId);
|
|
}
|
|
|
|
_raids = RaidService.GetRaids();
|
|
}
|
|
}
|