forked from React-Group/interstellar_ai
fixed some database backend stuff
This commit is contained in:
parent
26b69a1cb6
commit
223f953648
8 changed files with 58 additions and 41 deletions
16
py/api.py
16
py/api.py
|
@ -89,20 +89,20 @@ class API:
|
|||
|
||||
@self.app.route('/interstellar_ai/db', methods=['POST'])
|
||||
def db_manipulate():
|
||||
action = request.args.get('action')
|
||||
data = request.args.get('data')
|
||||
sent_data = request.get_json()
|
||||
action = sent_data.get('action')
|
||||
if action == "create_account":
|
||||
return jsonify({'status': 200, 'response': self.db.add_user(data)})
|
||||
return jsonify({'status': 200, 'response': self.db.add_user(sent_data)})
|
||||
elif action == "change_password":
|
||||
return jsonify({'status': 200, 'response': self.db.update_password(data)})
|
||||
return jsonify({'status': 200, 'response': self.db.update_password(sent_data)})
|
||||
elif action == "get_data":
|
||||
return jsonify({'status': 200, 'response': self.db.get_data(data)})
|
||||
return jsonify({'status': 200, 'response': self.db.get_data(sent_data)})
|
||||
elif action == "change_data":
|
||||
return jsonify({'status': 200, 'response': self.db.change_data(data)})
|
||||
return jsonify({'status': 200, 'response': self.db.change_data(sent_data)})
|
||||
elif action == "check_credentials":
|
||||
return jsonify({'status': 200, 'response': self.db.check_credentials(data)})
|
||||
return jsonify({'status': 200, 'response': self.db.check_credentials(sent_data)})
|
||||
elif action == "delete_account":
|
||||
return jsonify({'status': 200, 'response': self.db.delete_user(data)})
|
||||
return jsonify({'status': 200, 'response': self.db.delete_user(sent_data)})
|
||||
|
||||
return jsonify({'status': 401, 'response': "Invalid action"})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue