fix where you could have 0 decks in flashcards
This commit is contained in:
parent
2e09e54b18
commit
b470cf0e39
1 changed files with 3 additions and 1 deletions
|
@ -87,7 +87,9 @@
|
||||||
<div class="flex gap-3">
|
<div class="flex gap-3">
|
||||||
<button
|
<button
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if (confirm("Are you sure you want to delete this deck?")) {
|
if (deck.length == 2) {
|
||||||
|
toast.error("You need to have at least 1 deck");
|
||||||
|
} else if (confirm("Are you sure you want to delete this deck?")) {
|
||||||
deck.splice(CurrentlyEditingDeckId, 1);
|
deck.splice(CurrentlyEditingDeckId, 1);
|
||||||
CurrentlyEditingDeckId = Math.max(0, CurrentlyEditingDeckId - 1);
|
CurrentlyEditingDeckId = Math.max(0, CurrentlyEditingDeckId - 1);
|
||||||
DeckOptions.value = CurrentlyEditingDeckId.toString();
|
DeckOptions.value = CurrentlyEditingDeckId.toString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue