mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
api layer v0.2.5 - graphql standardization
This commit is contained in:
@@ -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