diff --git a/src/layouts/page/ProjectLayout.tsx b/src/layouts/page/ProjectLayout.tsx index 00e94da9..0bf3eefc 100644 --- a/src/layouts/page/ProjectLayout.tsx +++ b/src/layouts/page/ProjectLayout.tsx @@ -1,21 +1,23 @@ import { useMemo } from 'react'; import { Navigate, NavLink, Outlet, useParams } from 'react-router-dom'; +import { RiSettings5Fill } from 'react-icons/ri'; +import { ProjectContext } from '@hooks/useProjectContext'; import useModal from '@hooks/useModal'; +import useReadProjects from '@hooks/query/useProjectQuery'; import ListSidebar from '@components/sidebar/ListSidebar'; import ListProject from '@components/sidebar/ListProject'; import CreateModalTask from '@components/modal/task/CreateModalTask'; import CreateModalProjectStatus from '@components/modal/project-status/CreateModalProjectStatus'; -import { ProjectContext } from '@hooks/useProjectContext'; -import { PROJECT_DUMMY } from '@mocks/mockData'; -import { RiSettings5Fill } from 'react-icons/ri'; export default function ProjectLayout() { - const { projectId } = useParams(); + const { teamId, projectId } = useParams(); + const { projectList } = useReadProjects(Number(teamId)); const { showModal: showTaskModal, openModal: openTaskModal, closeModal: closeTaskModal } = useModal(); const { showModal: showStatusModal, openModal: openStatusModal, closeModal: closeStatusModal } = useModal(); + const project = useMemo( - () => PROJECT_DUMMY.find((project) => project.projectId.toString() === projectId), - [projectId], + () => projectList?.find((project) => project.projectId.toString() === projectId), + [projectList, projectId], ); if (!project) return ; @@ -24,7 +26,7 @@ export default function ProjectLayout() { <>
- +