added user to order
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
var amqpUri string = "amqp://guest:guest@rabbitmq:5672/"
|
||||
|
||||
var (
|
||||
rabbitConn *amqp.Connection
|
||||
rabbitChan *amqp.Channel
|
||||
rabbitCloseError chan *amqp.Error
|
||||
rabbitReady chan bool
|
||||
@@ -37,8 +36,7 @@ func rabbitConnector(uri string) {
|
||||
rabbitErr = <-rabbitCloseError
|
||||
if rabbitErr != nil {
|
||||
log.Printf("Connecting to %s\n", amqpUri)
|
||||
rabbitConn = connectToRabbitMQ(uri)
|
||||
rabbitCloseError = make(chan *amqp.Error)
|
||||
rabbitConn := connectToRabbitMQ(uri)
|
||||
rabbitConn.NotifyClose(rabbitCloseError)
|
||||
|
||||
var err error
|
||||
|
@@ -27,11 +27,11 @@ def pay(id):
|
||||
|
||||
# Generate order id
|
||||
orderid = str(uuid.uuid4())
|
||||
queueOrder({ 'order': orderid, 'cart': cart })
|
||||
queueOrder({ 'orderid': orderid, 'user': id, 'cart': cart })
|
||||
|
||||
# TDOD - order history
|
||||
|
||||
return jsonify({ 'order': orderid })
|
||||
return jsonify({ 'orderid': orderid })
|
||||
|
||||
|
||||
def queueOrder(order):
|
||||
|
@@ -344,7 +344,7 @@
|
||||
data: $scope.data.cart
|
||||
}).then((res) => {
|
||||
console.log('order', res.data);
|
||||
$scope.data.message = 'Order placed ' + res.data.order;
|
||||
$scope.data.message = 'Order placed ' + res.data.orderid;
|
||||
// clear down cart
|
||||
$scope.data.cart = {
|
||||
total: 0,
|
||||
|
Reference in New Issue
Block a user