Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,25 +76,27 @@ def order():
|
|
76 |
def final():
|
77 |
return render_template("final.html")
|
78 |
|
79 |
-
@app.route("/
|
80 |
-
def
|
81 |
data = request.json
|
82 |
name = data.get('name')
|
83 |
email = data.get('email')
|
84 |
phone = data.get('phone')
|
|
|
85 |
|
86 |
-
if not name or not email or not phone:
|
87 |
-
return jsonify({'error': 'Missing
|
88 |
|
89 |
try:
|
90 |
-
|
91 |
'Name': name,
|
92 |
'Email__c': email,
|
93 |
-
'Phone_Number__c': phone
|
|
|
94 |
})
|
95 |
|
96 |
-
if
|
97 |
-
return jsonify({'success': True})
|
98 |
else:
|
99 |
return jsonify({'error': 'Failed to create record'}), 500
|
100 |
|
|
|
76 |
def final():
|
77 |
return render_template("final.html")
|
78 |
|
79 |
+
@app.route("/register", methods=["POST"])
|
80 |
+
def register():
|
81 |
data = request.json
|
82 |
name = data.get('name')
|
83 |
email = data.get('email')
|
84 |
phone = data.get('phone')
|
85 |
+
password = data.get('password')
|
86 |
|
87 |
+
if not name or not email or not phone or not password:
|
88 |
+
return jsonify({'error': 'Missing required fields'}), 400
|
89 |
|
90 |
try:
|
91 |
+
customer_register = sf.Customer_Login__c.create({
|
92 |
'Name': name,
|
93 |
'Email__c': email,
|
94 |
+
'Phone_Number__c': phone,
|
95 |
+
'Password__c': password
|
96 |
})
|
97 |
|
98 |
+
if customer_register.get('id'):
|
99 |
+
return jsonify({'success': True, 'id': customer_register['id']}), 200
|
100 |
else:
|
101 |
return jsonify({'error': 'Failed to create record'}), 500
|
102 |
|