-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#11 feat: nav 팀 대시보드 api 연동 & 팀 대시보드 api type 추가 & Navbar 대시보드 연동 반영
- Loading branch information
1 parent
c86e058
commit 4dc55f4
Showing
4 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* 팀 대시보드 조회 커스텀 훅 | ||
*/ | ||
|
||
import { useEffect, useState } from 'react'; | ||
import { searchTeamDashBoard } from '../api/BoardApi'; | ||
import { TeamDashboardResponse } from '../types/TeamDashBoard'; | ||
|
||
const useTeamDashBoard = () => { | ||
const [teamDashboard, setTeamDashboard] = useState<TeamDashboardResponse>(); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
try { | ||
const data = await searchTeamDashBoard(); // 서버에서 데이터를 받아옵니다. | ||
setTeamDashboard(data); // 받아온 데이터를 상태에 저장합니다. | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; | ||
|
||
fetchData(); | ||
}, []); | ||
|
||
return { teamDashboard }; | ||
}; | ||
|
||
export default useTeamDashBoard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 각 요소의 타입을 정의 | ||
export interface TeamDashboardInfoResDto { | ||
dashboardId: string | null; | ||
myId: string | null; | ||
creatorId: string | null; | ||
title: string; | ||
description: string; | ||
blockProgress: number; | ||
joinMembers: string[] | null; // joinMembers가 배열일 수 있으므로 string[]로 정의. 타입에 따라 다를 수 있음. | ||
} | ||
|
||
export interface PageInfoResDto { | ||
currentPage: number; | ||
totalPages: number; | ||
totalItems: number; | ||
} | ||
|
||
// 전체 응답 구조를 정의 | ||
export interface TeamDashboardResponse { | ||
statusCode: number; | ||
message: string; | ||
data: { | ||
teamDashboardInfoResDto: TeamDashboardInfoResDto[]; | ||
pageInfoResDto: PageInfoResDto; | ||
}; | ||
} |