39 lines
800 B
Plaintext
39 lines
800 B
Plaintext
@inject LinksClient Links
|
|
|
|
<article>
|
|
<h3>@Item.Url</h3>
|
|
<p>
|
|
<NavLink href=@($"/links/{Item.Id}")>Afficher le lien</NavLink>
|
|
</p>
|
|
<div>
|
|
<AuthorizeView>
|
|
<Authorized>
|
|
<button @onclick="Upvote">👍 @Item.UpvotesCount</button>
|
|
/ <button @onclick="Downvote"> 👎 @Item.DownvotesCount</button>
|
|
</Authorized>
|
|
<NotAuthorized>
|
|
<p>
|
|
👍 @Item.UpvotesCount
|
|
/ 👎 @Item.DownvotesCount
|
|
</p>
|
|
</NotAuthorized>
|
|
</AuthorizeView>
|
|
</div>
|
|
</article>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public LinkDto Item { get; set; }
|
|
|
|
private async Task Upvote()
|
|
{
|
|
await Links.UpvoteAsync(Item.Id);
|
|
Item.UpvotesCount++;
|
|
}
|
|
|
|
private async Task Downvote()
|
|
{
|
|
await Links.DownvoteAsync(Item.Id);
|
|
Item.DownvotesCount++;
|
|
}
|
|
} |