finish add/buy in frontend

This commit is contained in:
2019-10-03 12:37:22 +02:00
parent 2e7afa9bb0
commit 60b489e8fd
6 changed files with 50 additions and 42 deletions

View File

@@ -23,11 +23,20 @@ export default {
},
buyItems(items) {
AppStorage.buyItems(items)
.then(_ => this.notifications.push(`Bought ${items.length} items`))
.then((items) => {
this.notifications.push(`Bought ${items.length} items`)
this.loot = this.loot.concat(items);
})
},
sellItems (items) {
AppStorage.sellItems(items)
.then(_ => this.notifications.push(`Sold ${items.length} items`))
.then(_ => {
this.notifications.push(`Sold ${items.length} items`)
for (var idx in items) {
var to_remove = items[idx][0];
this.loot = this.loot.filter((item) => item.id != to_remove);
}
})
},
parseLoot (items) {
this.loot = [];