mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-10-27 19:41:02 -04:00
api layer v0.2.5 - graphql standardization
This commit is contained in:
1 parent
cbf2cd0ee8
commit
73fd094cfc
3 files changed
+30
-10
No files matched your search
@@ -64,8 +64,15 @@ def graphql_endpoint():
|
||||
# Execute the GraphQL query
|
||||
result = devicesSchema.execute(data.get("query"), variables=data.get("variables"))
|
||||
|
||||
# Return the result as JSON
|
||||
return jsonify(result.data)
|
||||
# Initialize response
|
||||
response = {}
|
||||
|
||||
if result.errors:
|
||||
response["errors"] = [str(e) for e in result.errors]
|
||||
if result.data:
|
||||
response["data"] = result.data
|
||||
|
||||
return jsonify(response)
|
||||
|
||||
# --------------------------
|
||||
# Device Endpoints
|
||||
|
||||
Reference in new issue
Block a user