Route dashboard API

This commit is contained in:
Dita Aji Pratama 2024-09-26 12:38:04 +07:00
parent 6cc4bc36c1
commit 2ae101d5f1

View File

@ -223,3 +223,53 @@ def index(type):
except Exception as e: except Exception as e:
print(str(e)) print(str(e))
return json.dumps({}, indent = 2).encode() return json.dumps({}, indent = 2).encode()
@app.route('/api/dashboard/roles/list', method='POST')
def index():
try:
params = request.json
response.content_type = 'application/json'
return json.dumps(api_dashboard_roles.roles().list(params), indent = 2).encode()
except Exception as e:
print(str(e))
return json.dumps({}, indent = 2).encode()
@app.route('/api/dashboard/roles/add', method='POST')
def index():
try:
params = request.json
response.content_type = 'application/json'
return json.dumps(api_dashboard_roles.roles().add(params), indent = 2).encode()
except Exception as e:
print(str(e))
return json.dumps({}, indent = 2).encode()
@app.route('/api/dashboard/roles/edit', method='POST')
def index():
try:
params = request.json
response.content_type = 'application/json'
return json.dumps(api_dashboard_roles.roles().edit(params), indent = 2).encode()
except Exception as e:
print(str(e))
return json.dumps({}, indent = 2).encode()
@app.route('/api/dashboard/roles/remove', method='POST')
def index():
try:
params = request.json
response.content_type = 'application/json'
return json.dumps(api_dashboard_roles.roles().remove(params), indent = 2).encode()
except Exception as e:
print(str(e))
return json.dumps({}, indent = 2).encode()
@app.route('/api/dashboard/users/list', method='POST')
def index():
try:
params = request.json
response.content_type = 'application/json'
return json.dumps(api_dashboard_users.users().list(params), indent = 2).encode()
except Exception as e:
print(str(e))
return json.dumps({}, indent = 2).encode()