lokesh341 commited on
Commit
896f1e0
·
verified ·
1 Parent(s): 9d60053

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -76,25 +76,27 @@ def order():
76
  def final():
77
  return render_template("final.html")
78
 
79
- @app.route("/submit", methods=["POST"])
80
- def submit():
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 data'}), 400
88
 
89
  try:
90
- customer_login = sf.Customer_Login__c.create({
91
  'Name': name,
92
  'Email__c': email,
93
- 'Phone_Number__c': phone
 
94
  })
95
 
96
- if customer_login.get('id'):
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