feat: add confirmation dialogs for deleting exercises and routines
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
@inject ApiClient Api
|
||||
@inject NavigationManager Navigation
|
||||
@inject UserContext UserContext
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<PageTitle>Exercises</PageTitle>
|
||||
|
||||
@@ -154,6 +155,9 @@
|
||||
|
||||
private async Task DeleteExerciseAsync(int exerciseId)
|
||||
{
|
||||
var confirmed = await JS.InvokeAsync<bool>("confirm", "Are you sure you want to delete this exercise?");
|
||||
if (!confirmed) return;
|
||||
|
||||
await Api.DeleteExerciseAsync(UserContext.UserId, exerciseId);
|
||||
ExerciseList.RemoveAll(e => e.Id == exerciseId);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
@inject ApiClient Api
|
||||
@inject NavigationManager Navigation
|
||||
@inject UserContext UserContext
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<PageTitle>Routines</PageTitle>
|
||||
|
||||
@@ -255,6 +256,9 @@
|
||||
|
||||
private async Task DeleteRoutineAsync(int routineId)
|
||||
{
|
||||
var confirmed = await JS.InvokeAsync<bool>("confirm", "Are you sure you want to delete this routine?");
|
||||
if (!confirmed) return;
|
||||
|
||||
await Api.DeleteRoutineAsync(UserContext.UserId, routineId);
|
||||
RoutineList.RemoveAll(r => r.Id == routineId);
|
||||
}
|
||||
@@ -288,8 +292,11 @@
|
||||
return ExerciseList.FirstOrDefault(e => e.Id == exerciseId)?.Name ?? "Exercise";
|
||||
}
|
||||
|
||||
private void AbortRun()
|
||||
private async Task AbortRun()
|
||||
{
|
||||
var confirmed = await JS.InvokeAsync<bool>("confirm", "Are you sure you want to abort this routine run?");
|
||||
if (!confirmed) return;
|
||||
|
||||
ActiveRun = null;
|
||||
RunEntries = new List<RoutineRunEntryDto>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user