Skip to content

Commit

Permalink
#83 fix : 팀 대시보드 진행률 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamong0620 committed Sep 25, 2024
1 parent 759407a commit 358aec5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/api/TeamDashBoardApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ export const patchTeamDashBoard = async (
// * 팀 대시보드 상세 정보 get
export const getTeamDashboard = async (
dashboardId: string
): Promise<TeamDashboardInfoResDto | undefined> => {
): Promise<TeamDashboardInfoResDto | null> => {
try {
const response = await axiosInstance.get(`/dashboards/team/${dashboardId}`);
console.log('팀 대시보드 중간 확인', response);
return response.data.data;
} catch (error) {
console.error('팀 대시보드 중간 확인에서 error');
return null;
}
};

Expand Down
1 change: 0 additions & 1 deletion src/components/NotStartedDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const NotStartedDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {

useEffect(() => {
if (inView) {
console.log('되긴함?');
onLoadMore(); // 부모 컴포넌트에 새로운 데이터 요청
}
}, [inView]);
Expand Down
14 changes: 10 additions & 4 deletions src/pages/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,12 @@ const MainPage = () => {

const updateProgress = async () => {
try {
// 완료된 블록의 진행률을 다시 받아옴
const updatedDashboardDetail = await getPersonalDashboard(dashboardId);
const [updatedDashboardDetail, updatedTeamDashboardDetail] = await Promise.all([
getPersonalDashboard(dashboardId),
getTeamDashboard(dashboardId),
]);
setDashboardDetail(updatedDashboardDetail); // 진행률 업데이트
setTeamDashboardDetail(updatedTeamDashboardDetail);
} catch (error) {
console.error('Error updating progress', error);
}
Expand Down Expand Up @@ -280,8 +283,11 @@ const MainPage = () => {

// 대시보드 상세 정보 가져오기
const fetchDashboardData = async () => {
const data = await getPersonalDashboard(dashboardId);
if (data) setDashboardDetail(data);
const personalData = await getPersonalDashboard(dashboardId);
const teamData = await getTeamDashboard(dashboardId);

if (personalData) setDashboardDetail(personalData);
if (teamData) setTeamDashboardDetail(teamData);
};

// 유효한 데이터에 따라 mainTitle과 subTitle을 설정
Expand Down

0 comments on commit 358aec5

Please sign in to comment.