Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -151,18 +151,18 @@ def submit():
|
|
| 151 |
|
| 152 |
|
| 153 |
# Menu endpoint: Fetch and display the menu
|
| 154 |
-
@app.route(
|
| 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 |
-
#
|
| 162 |
-
return
|
| 163 |
-
|
| 164 |
except Exception as e:
|
| 165 |
-
return jsonify({"error": f"Failed to fetch menu items
|
| 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
|