adds buy/sell endpoints

This commit is contained in:
2019-08-07 15:34:08 +02:00
parent 6e7a0f6211
commit cb98b97126
5 changed files with 149 additions and 47 deletions

View File

@@ -89,8 +89,12 @@
methods: {
buySelectedItems () {
const items = this.items.filter(i => this.selected_items.includes(i.id));
this.$emit("buy", items);
this.selected_items.length = 0;
var payload = [];
items.forEach(item => {
payload.push([item.id, null]);
});
this.$emit("buy", payload);
this.selected_items = [];
},
sellSelectedItems () {
if (!this.is_selling) {
@@ -99,7 +103,11 @@
this.is_selling = false;
if (this.selected_items.length > 0) {
const items = this.items.filter(i => this.selected_items.includes(i.id));
this.$emit("sell", items);
var payload = [];
items.forEach(item => {
payload.push([item.id, null]);
});
this.$emit("sell", payload);
this.selected_items = [];
}
}