Skip to content

Commit

Permalink
fix: router 경로 변경
Browse files Browse the repository at this point in the history
- api 불러오는 이름 수정

#380
  • Loading branch information
yeonddori committed Jan 12, 2025
1 parent 2af6aee commit 352b206
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/containers/study/Modal/LeaveStudyModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { Text } from '@chakra-ui/react';
import { useRouter } from 'next/navigation';

import { leaveStudy } from '@/app/api/study';
import { leaveStudy as leaveStudyApi } from '@/app/api/study';
import ConfirmModal from '@/components/Modal/ConfirmModal';
import { useMutateWithToken } from '@/hooks/useFetchWithToken';
import useRefetchSideBar from '@/hooks/useRefetchSideBar';

import { LeaveStudyModalProps } from '../types';

const LeaveStudyModal = ({ id, name, teamId, isOpen, setIsOpen }: LeaveStudyModalProps) => {
const leaveStudyAction = useMutateWithToken(leaveStudy);
const leaveStudy = useMutateWithToken(leaveStudyApi);
const refetchSidebar = useRefetchSideBar();
const router = useRouter();

const handleClickLeave = () => {
leaveStudyAction(id).then((res) => {
leaveStudy(id).then((res) => {
if (res.ok) {
refetchSidebar();
setIsOpen(false);
router.replace(`/team/${teamId}/studies`);
router.replace(`/team/${teamId}`);
}
});
};
Expand Down

0 comments on commit 352b206

Please sign in to comment.