Skip to content

Commit

Permalink
Merge pull request #209 from INtiful/fix/hyuk/KAN-134-after-making-re…
Browse files Browse the repository at this point in the history
…view

fix: 리뷰 작성 후 해당 게시물 상세 페이지로 이동
  • Loading branch information
BeMatthewsong authored Oct 18, 2024
2 parents f86f397 + d02ab23 commit a0bbbd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/app/components/Modal/MakeGatheringModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ const MakeGatheringModal = ({ onClose }: MakeGatheringModalProps) => {
}

onClose();

await postGatheringToJoin(data.id);

router.push(`/gatherings/${data.id}`);

toast.success(message);
};

Expand Down
8 changes: 6 additions & 2 deletions src/app/components/Modal/ReviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ModalFrame from './ModalFrame';
import ModalHeader from './ModalHeader';
import CommentReview from './ReviewModal/CommentReview';
import HeartReview from './ReviewModal/HeartReview';
import { useRouter } from 'next/navigation';

interface ReviewModalProps {
gatheringId: number;
Expand All @@ -18,12 +19,14 @@ const ReviewModal = ({ gatheringId, onClose }: ReviewModalProps) => {
const [comment, setComment] = useState<string>('');
const [score, setScore] = useState<number>(0);

const router = useRouter();

const handleChangeReviewComment = (e: ChangeEvent<HTMLTextAreaElement>) => {
setComment(e.target.value);
};

const handleSubmit = async () => {
const { success, message } = await postReviews({
const { success, data, message } = await postReviews({
gatheringId,
score,
comment,
Expand All @@ -35,8 +38,9 @@ const ReviewModal = ({ gatheringId, onClose }: ReviewModalProps) => {
return;
}

toast.success(message);
onClose();
router.push(`/gatherings/${data?.gatheringId}`);
toast.success(message);
};

return (
Expand Down

0 comments on commit a0bbbd5

Please sign in to comment.