cached-request-9
Some checks failed
deploy / deploy (push) Failing after 1m1s

This commit is contained in:
2023-12-19 20:19:16 +03:00
parent 2380e88168
commit 2253bcf956
6 changed files with 26 additions and 56 deletions

View File

@@ -2,7 +2,7 @@ from functools import wraps
from aiohttp import ClientSession
from starlette.exceptions import HTTPException
from services.core import get_all_authors, cached_authors
from services.core import get_author
from settings import AUTH_URL
@@ -60,8 +60,7 @@ def login_required(f):
user_id = await check_auth(req)
if user_id:
context["user_id"] = user_id
authors_by_user, authors_by_id = get_all_authors() if not cached_authors else cached_authors
author = authors_by_user.get(user_id)
author = get_author(user_id)
if author and "id" in author:
context["author_id"] = author["id"]
return await f(*args, **kwargs)