Fix API Key parameter in get_component_likes_count
method.
This commit is contained in:
parent
966451f6a8
commit
581c9a8853
2 changed files with 3 additions and 3 deletions
|
|
@ -228,7 +228,7 @@ async def like_component(
|
|||
):
|
||||
try:
|
||||
result = await store_service.like_component(store_api_Key, str(component_id))
|
||||
likes_count = await store_service.get_component_likes_count(str(component_id))
|
||||
likes_count = await store_service.get_component_likes_count(str(component_id), store_api_Key)
|
||||
|
||||
return UsersLikesResponse(likes_count=likes_count, liked_by_user=result)
|
||||
except Exception as exc:
|
||||
|
|
|
|||
|
|
@ -320,13 +320,13 @@ class StoreService(Service):
|
|||
likes = await self._get(url, api_key, params)
|
||||
return likes
|
||||
|
||||
async def get_component_likes_count(self, component_id: str) -> int:
|
||||
async def get_component_likes_count(self, component_id: str, api_key: Optional[str] = None) -> int:
|
||||
url = f"{self.components_url}/{component_id}"
|
||||
|
||||
params = {
|
||||
"fields": ",".join(["id", "count(liked_by)"]),
|
||||
}
|
||||
result = await self._get(url, api_key=None, params=params)
|
||||
result = await self._get(url, api_key=api_key, params=params)
|
||||
if len(result) == 0:
|
||||
raise ValueError("Component not found")
|
||||
likes = result[0]["liked_by_count"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue