|
@@ -78,8 +78,6 @@ export class JournalInventoryComponent {
|
|
|
this.dataAccessor.consumables = list;
|
|
|
} else if (listName === 'miscellaneous') {
|
|
|
this.dataAccessor.miscellaneous = list;
|
|
|
- } else {
|
|
|
- throw new Error('Unknown list name: ' + listName);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -94,10 +92,8 @@ export class JournalInventoryComponent {
|
|
|
this.updateDatabase(listName);
|
|
|
} else if (result.state === 'update') {
|
|
|
this.openItemModal(true, listName, list, index);
|
|
|
- } else if (result.state === 'dismiss') {
|
|
|
+ } else if (result.state === 'cancel') {
|
|
|
// Do nothing
|
|
|
- } else {
|
|
|
- throw new Error('DND-Error: Unknown state: ' + result.state);
|
|
|
}
|
|
|
resultSubscription.unsubscribe();
|
|
|
}
|
|
@@ -115,10 +111,8 @@ export class JournalInventoryComponent {
|
|
|
this.dataAccessor.food = this.food;
|
|
|
} else if (result.state === 'update') {
|
|
|
this.openFoodModal(true, index);
|
|
|
- } else if (result.state === 'dismiss') {
|
|
|
+ } else if (result.state === 'cancel') {
|
|
|
// Do nothing
|
|
|
- } else {
|
|
|
- throw new Error('DND-Error: Unknown state: ' + result.state);
|
|
|
}
|
|
|
resultSubscription.unsubscribe();
|
|
|
}
|
|
@@ -142,10 +136,8 @@ export class JournalInventoryComponent {
|
|
|
} else if (result.state === 'add') {
|
|
|
this.food.push(result.data);
|
|
|
this.updateFood();
|
|
|
- } else if (result.state === 'dismiss') {
|
|
|
+ } else if (result.state === 'cancel') {
|
|
|
// Do nothing
|
|
|
- } else {
|
|
|
- throw new Error('DND-Error: Unknown state: ' + result.state);
|
|
|
}
|
|
|
resultSubscription.unsubscribe();
|
|
|
}
|
|
@@ -175,8 +167,6 @@ export class JournalInventoryComponent {
|
|
|
this.updateDatabase(listname);
|
|
|
} else if (result.state === 'cancel') {
|
|
|
// Do nothing
|
|
|
- } else {
|
|
|
- throw new Error('DND-Error: Unknown state: ' + result.state);
|
|
|
}
|
|
|
resultSubscription.unsubscribe();
|
|
|
}
|
|
@@ -185,26 +175,16 @@ export class JournalInventoryComponent {
|
|
|
|
|
|
public addItem(table: string): void {
|
|
|
if (table === 'items') {
|
|
|
- switch (this.active) {
|
|
|
- case 1:
|
|
|
- this.openItemModal(false, 'weaponsAndArmor', this.weaponsAndArmor);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- this.openItemModal(false, 'miscellaneous', this.miscellaneous);
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new Error('Unknown active tab: ' + this.active);
|
|
|
+ if (this.active === 1) {
|
|
|
+ this.openItemModal(false, 'weaponsAndArmor', this.weaponsAndArmor);
|
|
|
+ } else {
|
|
|
+ this.openItemModal(false, 'miscellaneous', this.miscellaneous);
|
|
|
}
|
|
|
} else if (table === 'consumables') {
|
|
|
- switch (this.foodActive) {
|
|
|
- case 1:
|
|
|
- this.openFoodModal(false);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- this.openItemModal(false, 'consumables', this.consumables);
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new Error('Unknown food active tab: ' + this.foodActive);
|
|
|
+ if (this.foodActive === 1) {
|
|
|
+ this.openFoodModal(false);
|
|
|
+ } else if (this.foodActive === 2) {
|
|
|
+ this.openItemModal(false, 'consumables', this.consumables);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -218,8 +198,6 @@ export class JournalInventoryComponent {
|
|
|
this.dataAccessor.consumables = this.consumables;
|
|
|
} else if (listname === 'miscellaneous') {
|
|
|
this.dataAccessor.miscellaneous = this.miscellaneous;
|
|
|
- } else {
|
|
|
- throw new Error('DND-ERROR: Unknown list name: ' + listname);
|
|
|
}
|
|
|
this.updateWeight();
|
|
|
}
|