Skip to content

Commit

Permalink
fix: bookmark id 할당 함수 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Songhyejeong committed Nov 15, 2024
1 parent dabeb3b commit 05201aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/common/store/StoreCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const StoreListCard = ({ image, alt, id, name, address, rating, positiveRatio, p
const navigate = useNavigate();
const { savedStores } = useSaveBookmarkId();

const bookmarkId = savedStores.filter((store) => store.storeResponseDto.storeId === id).bookmarkId;
const bookmark = savedStores.find((store) => store.storeResponseDto.storeId === id);
const bookmarkId = bookmark?.bookmarkId;

const cardClickHandler = () => {
navigate(`/webmap/storeDetail/${id}`);
Expand Down
3 changes: 2 additions & 1 deletion src/components/storeCard/TopStoreCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const TopStoreCard = ({ image, alt, bookmarkId, id, address, name, positiveRatio

useEffect(() => {
if (!bookmarkId) {
const bookmarkId = savedStores.filter((store) => store.storeResponseDto.storeId === id);
const bookmark = savedStores.find((store) => store.storeResponseDto.storeId === id);
const bookmarkId = bookmark?.bookmarkId;
setSavedId(bookmarkId);
}
// eslint-disable-next-line
Expand Down

0 comments on commit 05201aa

Please sign in to comment.