|
@@ -318,10 +318,8 @@ export class JournalSpellbookComponent {
|
|
|
const resultSubscription = this.modalAccessor.result$.subscribe(
|
|
|
(result) => {
|
|
|
if (result.state === 'delete') {
|
|
|
- result.data.forEach((spell: Spell) => {
|
|
|
- // TODO: Implement deletion of custom spells
|
|
|
- // this.deleteCustomSpell(spell);
|
|
|
- });
|
|
|
+ this.dataAccessor.deleteCustomSpellArray(result.data);
|
|
|
+ this.refreshFilteredSpells();
|
|
|
}
|
|
|
resultSubscription.unsubscribe();
|
|
|
},
|
|
@@ -348,6 +346,7 @@ export class JournalSpellbookComponent {
|
|
|
alreadyPrepared: alreadyPrepared,
|
|
|
alreadyInFavorites: alreadyInFavorites,
|
|
|
});
|
|
|
+ // This subscription is used to receive messages from the spellcard without closing the modal.
|
|
|
const actionSubscription = this.modalAccessor.action$.subscribe(
|
|
|
(message) => {
|
|
|
if (message.action === 'addToFavorites') {
|
|
@@ -361,18 +360,16 @@ export class JournalSpellbookComponent {
|
|
|
}
|
|
|
},
|
|
|
);
|
|
|
+ // This subscription is used to receive the result from the spellcard modal.
|
|
|
const resultSubscription = this.modalAccessor.result$.subscribe(
|
|
|
(result) => {
|
|
|
resultSubscription.unsubscribe();
|
|
|
actionSubscription.unsubscribe();
|
|
|
-
|
|
|
if (result.state === 'copy') {
|
|
|
setTimeout(() => {
|
|
|
this.openSpellCreationModal(true, spell);
|
|
|
}, 100);
|
|
|
} else if (result.state === 'update') {
|
|
|
- console.log('Update spell, caught in spellbook component');
|
|
|
- // TODO: Implement Modification of spells
|
|
|
setTimeout(() => {
|
|
|
this.openSpellModificationModal(spell);
|
|
|
}, 100);
|