finish add/buy in frontend
This commit is contained in:
@@ -103,10 +103,10 @@
|
||||
this.is_selling = false;
|
||||
if (this.selected_items.length > 0) {
|
||||
const items = this.items.filter(i => this.selected_items.includes(i.id));
|
||||
var payload = [];
|
||||
items.forEach(item => {
|
||||
payload.push([item.id, null]);
|
||||
});
|
||||
var payload = [];
|
||||
items.forEach(item => {
|
||||
payload.push([item.id, null]);
|
||||
});
|
||||
this.$emit("sell", payload);
|
||||
this.selected_items = [];
|
||||
}
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
props: ["wealth", "debt"],
|
||||
data () {
|
||||
return {
|
||||
editing: false,
|
||||
edit_value: 0,
|
||||
editing: false,
|
||||
edit_value: 0,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -66,8 +66,8 @@
|
||||
this.resetValues();
|
||||
},
|
||||
resetValues () {
|
||||
this.editing = false;
|
||||
this.edit_value = 0;
|
||||
this.editing = false;
|
||||
this.edit_value = 0;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
Reference in New Issue
Block a user