fix(market-card.tsx): fix logic for updating likes_count and liked_by_user state variables

The logic for updating the `likes_count` and `liked_by_user` state variables in the `handleLike` function was incorrect. This commit fixes the logic to correctly update the state variables based on the previous values. Additionally, it adds error handling for the `postLikeComponent` API call and sets the `likes_count` and `liked_by_user` state variables to their previous values in case of an error.
This commit is contained in:
anovazzi1 2023-11-01 10:14:00 -03:00
commit 4310229c2f
2 changed files with 7 additions and 2 deletions

View file

@ -6,7 +6,6 @@ from typing import TYPE_CHECKING, List, Dict, Any, Optional, Union
import httpx
from httpx import HTTPError
from langflow.services.database.models import user
from langflow.services.store.schema import (
ComponentResponse,
DownloadComponentResponse,