Working with the web guided Restaurant app project - submit order data is missing

I'm working through the data collections course and am on the final steps of the restaurant app project.

Everything is working except the final submit order API call.

When the submit button is tapped, this IBAction calls uploadOrder():

@IBAction func submitOrderTapped(_ sender: Any) {
    let orderTotal = MenuController.shared.order.menuItems.reduce(0.0) {
      (result, menuItem) -> Double in
      return result + menuItem.price
    }
    let formattedTotal = orderTotal.formatted(.currency(code: "usd"))
     
    let alertController = UIAlertController(title: "Confirm Order", message: "You are about to submit your order with a total of \(formattedTotal)", preferredStyle: .actionSheet)
    alertController.addAction(UIAlertAction(title: "Submit", style: .default, handler: { _ in self.uploadOrder()
       
    }))
    alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
     
    present(alertController, animated: true, completion: nil)
  }

uploadOrder calls the shared submitOrder fuction:

func uploadOrder(){
    let menuIDs = MenuController.shared.order.menuItems.map {$0.id}
    Task.init {
      do {
        let minutesToPrepare = try await MenuController.shared.submitOrder(forMenuIDs: menuIDs)
        self.minutesToPrepareOrder = minutesToPrepare
        self.performSegue(withIdentifier: "confirmOrder", sender: nil)
      } catch {
        displayError(error, title: "Order Submission Failed")
      }
    }
  }

And submitOrder posts to the provided order API endpoint:

 func submitOrder(forMenuIDs menuIDs: [Int]) async throws -> MinutesToPrepare {
    let orderURL = baseURL!.appendingPathComponent("order")
    var request = URLRequest(url: orderURL)
     
    request.httpMethod = "POST"
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
     
    let menuIdsDict = ["menuIds": menuIDs]
    let jsonEncoder = JSONEncoder()
    let jsonData = try? jsonEncoder.encode(menuIdsDict)
     
    request.httpBody = jsonData
    let (data, response) = try await URLSession.shared.data(for: request)
    guard let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 else {
      throw menuControllerError.orderRequestFailed
    }
    let decoder = JSONDecoder()
    let orderResponse = try decoder.decode(OrderResponse.self, from: data)
     
    return orderResponse.prepTime
  }

Everything is basically by the book, but when uploadOrder is called, the error statement fires and displays "Order submission failed" and "The data couldn't be read because it is missing"

I'm trying to debug but unsuccessfully so far. Help appreciated.

Found it! All due to a simple spelling mistake in the OrderRespone model - 'CondingKeys' instead of 'CodingKeys'

I feel so stupid!

Working with the web guided Restaurant app project - submit order data is missing
 
 
Q