Browse Source

fixed the errorneous deletion of custom spells

Warafear 1 year ago
parent
commit
20a3929927

+ 0 - 4
src/app/journal/journal-spellcards/custom-spells-modal/custom-spells-modal.component.ts

@@ -24,15 +24,11 @@ export class CustomSpellsModalComponent {
   public delete(): void {
     const deletionList: Spell[] = [];
     this.indexList.forEach((index) => deletionList.push(this.spells[index]));
-    console.log('CustomSpellsModalComponent: delete', deletionList);
-
     this.modalAccessor.handleModalClosing('delete', deletionList);
     this.indexList = [];
   }
 
   public cancel(): void {
-    console.log('CustomSpellsModalComponent: cancel');
-
     this.modalAccessor.handleModalClosing('cancel', undefined);
     this.indexList = [];
   }

+ 3 - 6
src/app/journal/journal-spellcards/journal-spellcards.component.ts

@@ -162,6 +162,9 @@ export class JournalSpellcardsComponent {
     );
   }
 
+  /**
+   * Opens the modal to manage custom spells. Here, custom spells can be deleted.
+   */
   public openManageCustomSpellsModal(): void {
     this.modalAccessor.openModal(CustomSpellsModalComponent, {
       spells: this.dataAccessor.customSpells,
@@ -187,16 +190,10 @@ export class JournalSpellcardsComponent {
    * @param spell
    */
   public deleteCustomSpell(spell: Spell): void {
-    console.log(spell);
     this.dataAccessor.deleteCustomSpell(spell);
     this.spellsService.deleteCustomSpell(spell);
-
     let list = this.getSpellList(spell.level);
     const index = list.findIndex((spellList) => spellList.id === spell.id);
-    // const index = list.indexOf(spell);
-    console.log('liste: ', list);
-    console.log('Index of the spell to delete: ', index);
-
     if (index > -1) {
       list.splice(index, 1);
       this.dataAccessor.removeFavoriteSpell(spell);