@using Microsoft.AspNetCore.Components.WebAssembly.Authentication @using Start.Shared.Api @inject HttpClient Http @inject IBookmarkContainersApi bookmarkContainersApi @{ string title = $"Delete Container \"{this.ContainerTitle}\""; } @if (this.ShowAlert) {
There was an error deleting the bookmark container
}

Are you sure you want to delete the bookmark container "@this.ContainerTitle"?

@code { [Parameter] public int BookmarkContainerId { get; set; } [Parameter] public string ContainerTitle { get; set; } = null!; [Parameter] public bool Active { get; set; } [Parameter] public EventCallback OnDeleted { get; set; } [Parameter] public EventCallback OnClose { get; set; } public bool ShowAlert { get; set; } = false; public async Task OnDialogClose() { this.Active = false; await this.OnClose.InvokeAsync(); } public async Task OnConfirmDelete() { try { HttpResponseMessage result = await bookmarkContainersApi .DeleteBookmarkContainer(this.BookmarkContainerId); if (result.StatusCode == System.Net.HttpStatusCode.OK) { await this.OnDeleted.InvokeAsync(BookmarkContainerId); this.ShowAlert = false; this.Active = false; } else { this.ShowAlert = true; } } catch (AccessTokenNotAvailableException e) { e.Redirect(); } } }