diff --git a/front/src/pages/project/Project.tsx b/front/src/pages/project/Project.tsx index 8751318..5ca50b6 100644 --- a/front/src/pages/project/Project.tsx +++ b/front/src/pages/project/Project.tsx @@ -1,9 +1,9 @@ -import React, { useState, useEffect } from 'react'; -import axios from 'axios'; -import { NavLink } from 'react-router-dom'; -import moveImg from '../../images/login.png'; -import Menu from '../../components/frames/Side/Sidebar'; -import ProjectPopup from '../../components/Popup/ProjectPopup'; +import React, { useState, useEffect } from "react"; +import axios from "axios"; +import { NavLink } from "react-router-dom"; +import moveImg from "../../images/login.png"; +import Menu from "../../components/frames/Side/Sidebar"; +import ProjectPopup from "../../components/Popup/ProjectPopup"; interface Manager { id: number; @@ -33,7 +33,7 @@ function Project() { useEffect(() => { async function fetchData(): Promise { try { - const response = await axios.get('projects?team-id=1'); + const response = await axios.get("projects?team-id=1"); setProjectData(response.data); console.log(response.data); } catch (error) { @@ -44,7 +44,7 @@ function Project() { }, []); const activeStyle = { - background: '#D8F1FF', + background: "#D8F1FF", }; return ( @@ -67,7 +67,7 @@ function Project() { (isActive ? activeStyle : {})} - to='/sprint' + to={`/sprint/${projectData.id}`} > (); + const { projectId } = useParams<{ projectId: string }>(); useEffect(() => { async function fetchData(): Promise { try { - const response = await axios.get("sprints?project-id=2"); + const response = await axios.get( + `sprints?project-id=${projectId}` + ); setSprintData(response.data); console.log(response.data, response.status); } catch (error) { @@ -42,7 +45,7 @@ function Sprint() { } } fetchData(); - }, []); + }, [projectId]); const activeStyle = { background: "#D8F1FF",