Skip to content

Commit

Permalink
update when the buy and sell is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Gobeli committed Aug 22, 2017
1 parent de43b40 commit cf2b0d6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/renderer/components/ExecuteModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
this.$bittrex.getmarketsummary({market: `BTC-${this.market}`},
(data, err) => this.marketSummary = handleResponse(data, err, this)[0] || {});
},
buy(done) {
buy(cb) {
this.$bittrex.buylimit({ market: `BTC-${this.market}`, quantity: this.quantity, rate: this.bid }, (data, err) => {
const res = handleResponse(data, err, this);
if (res.uuid) {
Expand All @@ -64,25 +64,27 @@
message: 'Buy-Order successfull',
type: 'success',
});
done();
cb();
}
});
},
sell() {
sell(cb) {
this.$bittrex.selllimit({ market: `BTC-${this.market}`, quantity: this.quantity, rate: this.ask }, (data, err) => {
const res = handleResponse(data, err, this);
if (res.uuid) {
this.$message({
message: 'Sell-Order successfull',
type: 'success',
});
cb();
}
});
},
submit() {
this.buy(this.sell.bind(this))
this.$bus.$emit('update');
this.$emit('close-modal');
this.buy(() => this.sell(() => {
this.$bus.$emit('update');
this.$emit('close-modal');
}));
}
}
}
Expand Down

0 comments on commit cf2b0d6

Please sign in to comment.