Fix bug on order saving

This commit is contained in:
Rene Vergara 2022-01-31 15:32:46 -06:00
parent d61a1169fd
commit ba631ebf24
1 changed files with 25 additions and 26 deletions

View File

@ -18,7 +18,7 @@ export class OrderService {
address: '',
session: '',
blocktime: 0,
expiration: 0,
expired: false,
pin: '',
validated: false
},
@ -193,33 +193,32 @@ export class OrderService {
closeOrder(){
this.fullnodeService.priceUpdate.subscribe((price) => {
console.log('Price:', price);
this.dataStore.order.closed = true;
this.dataStore.order.price = price;
let obs = this.http.post<{message: string, order: Order}>(this.beUrl+'api/order', {order: this.dataStore.order}, { headers: this.reqHeaders });
obs.subscribe((orderData) => {
console.log('Closed order', orderData);
this.dataStore.order = {
address: '',
session: '',
timestamp: '',
closed: false,
currency: '',
price: 0,
total: 0,
totalZec: 0,
lines: [
{
qty: 1,
name: '',
cost:0
}
]
};
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
});
return obs;
});
this.dataStore.order.closed = true;
let obs = this.http.post<{message: string, order: Order}>(this.beUrl+'api/order', {order: this.dataStore.order}, { headers: this.reqHeaders });
obs.subscribe((orderData) => {
console.log('Closed order', orderData);
this.dataStore.order = {
address: '',
session: '',
timestamp: '',
closed: false,
currency: '',
price: 0,
total: 0,
totalZec: 0,
lines: [
{
qty: 1,
name: '',
cost:0
}
]
};
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
});
return obs;
}
}