[251031] fix: correct API-based filter handler implementation in UserReviewPanel
- Import getUserReviewList action from productActions - Update handleApiRatingFilter to dispatch getUserReviewList directly instead of loadReviews - Remove loadReviews from Hook destructuring (not needed for filter handlers) - Use proper Redux dispatch pattern for API calls with filter parameters This ensures proper API routing when filter buttons are clicked. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import classNames from 'classnames';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
||||
import { popPanel, updatePanel } from '../../actions/panelActions';
|
||||
import { getUserReviewList } from '../../actions/productActions';
|
||||
import TBody from '../../components/TBody/TBody';
|
||||
import TPanel from '../../components/TPanel/TPanel';
|
||||
import useReviews, { REVIEW_VERSION } from '../../hooks/useReviews/useReviews';
|
||||
@@ -45,7 +46,6 @@ const UserReviewPanel = ({ className, panelInfo, spotlightId }) => {
|
||||
filters,
|
||||
filteredReviewListData,
|
||||
currentReviewFilter,
|
||||
loadReviews,
|
||||
} = useReviews(prdtId, patnrId); // REVIEW_VERSION 상수에 따라 자동으로 API 선택
|
||||
|
||||
const [isPaging, setIsPaging] = useState(false);
|
||||
@@ -135,7 +135,7 @@ const UserReviewPanel = ({ className, panelInfo, spotlightId }) => {
|
||||
|
||||
// API 기반 별점 필터 핸들러
|
||||
const handleApiRatingFilter = useCallback(
|
||||
async (rating) => {
|
||||
(rating) => {
|
||||
if (!prdtId || !patnrId) {
|
||||
console.warn('[UserReviewPanel] API 호출 실패: prdtId 또는 patnrId 없음');
|
||||
return;
|
||||
@@ -145,7 +145,7 @@ const UserReviewPanel = ({ className, panelInfo, spotlightId }) => {
|
||||
|
||||
if (rating === 'all') {
|
||||
// ALL 필터로 리뷰 재로드
|
||||
await dispatch(loadReviews({
|
||||
dispatch(getUserReviewList({
|
||||
prdtId,
|
||||
patnrId,
|
||||
filterTpCd: 'ALL',
|
||||
@@ -154,7 +154,7 @@ const UserReviewPanel = ({ className, panelInfo, spotlightId }) => {
|
||||
}));
|
||||
} else {
|
||||
// RATING 필터로 리뷰 조회
|
||||
await dispatch(loadReviews({
|
||||
dispatch(getUserReviewList({
|
||||
prdtId,
|
||||
patnrId,
|
||||
filterTpCd: 'RATING',
|
||||
@@ -164,7 +164,7 @@ const UserReviewPanel = ({ className, panelInfo, spotlightId }) => {
|
||||
}));
|
||||
}
|
||||
},
|
||||
[prdtId, patnrId, dispatch, loadReviews]
|
||||
[prdtId, patnrId, dispatch]
|
||||
);
|
||||
|
||||
const handleAllStarsFilter = useCallback(() => handleApiRatingFilter('all'), [handleApiRatingFilter]);
|
||||
|
||||
Reference in New Issue
Block a user