1
0
mirror of synced 2024-11-14 18:38:06 +01:00
TaikoLocalServer/TaikoWebUI/Pages/Dialogs/CardDeleteConfirmDialog.razor.cs
2022-09-12 00:33:58 +08:00

28 lines
763 B
C#

namespace TaikoWebUI.Pages.Dialogs;
public partial class CardDeleteConfirmDialog
{
[CascadingParameter]
MudDialogInstance MudDialog { get; set; } = null!;
[Parameter]
public User User { get; set; } = new();
private void Cancel() => MudDialog.Cancel();
private async Task DeleteCard()
{
var responseMessage = await Client.DeleteAsync($"api/Cards/{User.AccessCode}");
if (!responseMessage.IsSuccessStatusCode)
{
Snackbar.Add("Something went wrong when deleting card!", Severity.Error);
MudDialog.Close(DialogResult.Ok(false));
return;
}
Snackbar.Add("Delete success!", Severity.Success);
MudDialog.Close(DialogResult.Ok(true));
}
}