Fix user_data_context function to handle missing
api_key
This commit is contained in:
parent
f11d578efa
commit
afe9c9d1f4
1 changed files with 1 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ user_data_var: ContextVar[Optional[Dict[str, Any]]] = ContextVar(
|
||||||
def user_data_context(store_service: "StoreService", api_key: Optional[str] = None):
|
def user_data_context(store_service: "StoreService", api_key: Optional[str] = None):
|
||||||
# Fetch and set user data to the context variable
|
# Fetch and set user data to the context variable
|
||||||
if api_key:
|
if api_key:
|
||||||
|
user_data = None
|
||||||
try:
|
try:
|
||||||
user_data = store_service._get(
|
user_data = store_service._get(
|
||||||
f"{store_service.base_url}/users/me", api_key, params={"fields": "id"}
|
f"{store_service.base_url}/users/me", api_key, params={"fields": "id"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue