DSatishchandra commited on
Commit
067a15e
·
verified ·
1 Parent(s): 2469cb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -151,18 +151,18 @@ def submit():
151
 
152
 
153
  # Menu endpoint: Fetch and display the menu
154
- @app.route("/menu", methods=["GET"])
155
  def menu_page():
156
  try:
157
  # Query Salesforce for the menu items
158
  query = "SELECT Name, Price__c, Ingredients__c, Category__c FROM Menu_Item__c"
159
  result = sf.query(query)
160
 
161
- # Render the menu page template with menu items fetched from Salesforce
162
- return render_template("menu_page.html", menu_items=result['records'])
163
-
164
  except Exception as e:
165
- return jsonify({"error": f"Failed to fetch menu items from Salesforce: {str(e)}"}), 500
166
 
167
 
168
  # Order endpoint: Place the order and link it to the customer
 
151
 
152
 
153
  # Menu endpoint: Fetch and display the menu
154
+ @app.route('/menu', methods=['GET'])
155
  def menu_page():
156
  try:
157
  # Query Salesforce for the menu items
158
  query = "SELECT Name, Price__c, Ingredients__c, Category__c FROM Menu_Item__c"
159
  result = sf.query(query)
160
 
161
+ # Return the results as JSON
162
+ return jsonify(result['records'])
163
+
164
  except Exception as e:
165
+ return jsonify({"error": f"Failed to fetch menu items: {str(e)}"}), 500
166
 
167
 
168
  # Order endpoint: Place the order and link it to the customer