Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMPONENTS: Remove Post View #118

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ShouldRemovePostAsync -> PASS
  • Loading branch information
Stanislaw Nowak committed Oct 3, 2022
commit 12bab1fdfea895e8f9ba2cadd5099a22870c0347
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

<ButtonBase @ref=Button
Label="🗑"
OnClick="() => RemovePostAsync()" />
OnClick=@(async () => await RemovePostAsync()) />
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// FREE TO USE TO CONNECT THE WORLD
// ---------------------------------------------------------------

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Taarafo.Portal.Web.Models.PostViews;
Expand All @@ -26,9 +27,12 @@ public partial class PostRemoveComponent : ComponentBase
protected override void OnInitialized() =>
State = PostRemoveComponentState.Content;

public async Task RemovePostAsync()
public async ValueTask RemovePostAsync()
{
Button.Disable();

await this.PostViewService
.RemovePostViewByIdAsync(PostView.Id);
}
}
}