handle empty orders from queue

pull/86/head
James Sangalli 7 years ago
parent 27fd5d9210
commit bf5bc9f3a3
  1. 7
      Trust/Market/OrdersRequest.swift

@ -21,7 +21,7 @@ import BigInt
public class OrdersRequest {
public let baseURL = "https://482kdh4npg.execute-api.ap-southeast-1.amazonaws.com/dev/"
public let contractAddress = "0xacDe9017473D7dC82ACFd0da601E4de291a7d6b0"
public let contractAddress = "bC9a1026A4BC6F0BA8Bbe486d1D09dA5732B39e4".lowercased()
public func getOrders(callback: @escaping (_ result : Any) -> Void) {
Alamofire.request(baseURL + "contract/" + contractAddress, method: .get).responseJSON {
@ -31,6 +31,11 @@ public class OrdersRequest {
let parsedJSON = try! JSON(data: response.data!)
for i in 0...parsedJSON.count - 1 {
let orderObj: JSON = parsedJSON["orders"][i]
if(orderObj == nil)
{
callback("no orders")
return
}
orders.append(self.parseOrder(orderObj))
}
callback(orders)

Loading…
Cancel
Save