Iceshrimp.NET/Iceshrimp.Frontend/Components/FollowRequestEntry.razor
2024-07-11 01:06:18 +02:00

38 lines
No EOL
1.3 KiB
Text

@using Iceshrimp.Frontend.Localization
@using Iceshrimp.Shared.Schemas.Web
@using Microsoft.Extensions.Localization
@using Iceshrimp.Assets.PhosphorIcons
@using Iceshrimp.Frontend.Core.Services
@inject IStringLocalizer<Localization> Loc;
@inject ApiService Api;
@inject NavigationManager NavigationManager;
<div class="follow-request-card">
<UserProfileCard User="FollowRequest.User"></UserProfileCard>
<div class="buttons">
<button @onclick="Accept" class="btn accept">
<Icon Name="Icons.Check"/>
</button>
<button @onclick="Reject" class="btn decline">
<Icon Name="Icons.X"/>
</button>
</div>
</div>
@code {
[Parameter] [EditorRequired] public required FollowRequestResponse FollowRequest { get; set; }
private async void Accept()
{
// FIXME: This should be a fancy animation instead of a reload
await Api.FollowRequests.AcceptFollowRequest(FollowRequest.Id);
NavigationManager.NavigateTo("/follow-requests");
}
private async void Reject()
{
// FIXME: This should be a fancy animation instead of a reloady
await Api.FollowRequests.RejectFollowRequest(FollowRequest.Id);
NavigationManager.NavigateTo("/follow-requests");
}
}