Fix bug on order saving

This commit is contained in:
Rene Vergara 2022-01-31 15:32:46 -06:00
parent d61a1169fd
commit ba631ebf24

View file

@ -18,7 +18,7 @@ export class OrderService {
address: '', address: '',
session: '', session: '',
blocktime: 0, blocktime: 0,
expiration: 0, expired: false,
pin: '', pin: '',
validated: false validated: false
}, },
@ -193,33 +193,32 @@ export class OrderService {
closeOrder(){ closeOrder(){
this.fullnodeService.priceUpdate.subscribe((price) => { this.fullnodeService.priceUpdate.subscribe((price) => {
console.log('Price:', price);
this.dataStore.order.closed = true;
this.dataStore.order.price = price; 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;
} }
} }