some-fixes-graphql

This commit is contained in:
2023-10-12 15:28:12 +03:00
parent f6ef50f878
commit 405dbb49cf
2 changed files with 12 additions and 8 deletions

View File

@@ -32,13 +32,17 @@ async def check_auth(req):
if response.status_code != 200:
return False, None
r = response.json()
user_id = (
r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
if INTERNAL_AUTH_SERVER
else r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
)
is_authenticated = user_id is not None
return is_authenticated, user_id
try:
user_id = (
r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
if INTERNAL_AUTH_SERVER
else r.get("data", {}).get(query_name, {}).get("user", {}).get("id", None)
)
is_authenticated = user_id is not None
return is_authenticated, user_id
except Exception as e:
print(f"response contains no proper data: {r}")
return False, None
def login_required(f):