Skip to content

Commit

Permalink
✨feat: 팀원소개서 상세 페이지 나와 관련된 이슈 GET
Browse files Browse the repository at this point in the history
  • Loading branch information
100Gyeon committed Jan 18, 2022
1 parent c4ac0b0 commit 1f3ae09
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/infrastructure/api/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export interface TeamService {
getTeamProfile(): Promise<TeamProfileData>;
getMyTeamIssue(): Promise<TeamIssueData>;
getTeamIssue(teamID: string): Promise<TeamIssueData>;
getMyIssue(teamID:string): Promise<TeamIssueData>;
getInviteInfo(): Promise<TeamInviteData>;
}
6 changes: 6 additions & 0 deletions src/infrastructure/mock/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export function teamDataMock(): TeamService {
return TEAM_DATA.TEAM_ISSUE_INFO;
};

const getMyIssue = async () => {
await wait(2000);
return TEAM_DATA.TEAM_ISSUE_INFO;
};

const getInviteInfo = async () => {
await wait(2000);
return TEAM_DATA.TEAM_INVITE_INFO;
Expand All @@ -38,6 +43,7 @@ export function teamDataMock(): TeamService {
getTeamProfile,
getMyTeamIssue,
getTeamIssue,
getMyIssue,
getInviteInfo,
};
}
Expand Down
24 changes: 24 additions & 0 deletions src/infrastructure/remote/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,29 @@ export function teamDataRemote(): TeamService {
else throw '서버 통신 실패';
};

const getMyIssue = async (teamID: string) => {
const response = await privateAPI.get({ url: `/team/detail/${teamID}/issue/my` });
if (response.status === 200)
return {
issueListData: response.data.map((team: any) => ({
issueNumber: team.id,
issueMembers: team.feedback.map((member: any) => ({
id: member.userId,
profileName: member.name,
profileImage: member.image,
})),
category: team.categoryName,
createdAt: team.dates,
content: team.content,
teamID: team.teamId,
issueCardImage: team.teamImage,
teamName: team.teamname,
memberName: team.username,
})),
};
else throw '서버 통신 실패';
};

const postFeedbackBookmark = async () => {
await wait(1000);
return { isSuccess: true };
Expand Down Expand Up @@ -90,6 +113,7 @@ export function teamDataRemote(): TeamService {
getTeamProfile,
getMyTeamIssue,
getTeamIssue,
getMyIssue,
getInviteInfo,
getIssueInfo,
};
Expand Down
21 changes: 19 additions & 2 deletions src/presentation/pages/Team/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function TeamMain() {
});
})();
}, []);

useEffect(() => {
(async () => {
if (teamID === undefined) return;
Expand All @@ -45,6 +45,23 @@ function TeamMain() {
})();
}, []);

const checkMyIssue = () => {
setIsChecked(!isChecked);
if (!isChecked) {
(async () => {
if (teamID === undefined) return;
const { issueListData } = await api.teamService.getMyIssue(teamID);
setIssueListData(issueListData);
})();
} else {
(async () => {
if (teamID === undefined) return;
const { issueListData } = await api.teamService.getTeamIssue(teamID);
setIssueListData(issueListData);
})();
}
};

return (
<StTeamMain>
{teamInfoData && (
Expand Down Expand Up @@ -74,7 +91,7 @@ function TeamMain() {
)}
<button onClick={() => navigate(`/team/${teamID}/create`)}>이슈 추가하기</button>
<StCheckWrapper>
<button onClick={() => setIsChecked(!isChecked)}>
<button onClick={() => checkMyIssue()}>
<img src={isChecked ? icCoralCheck : icGrayCheck} />
</button>
나와 관련된 이슈만 보기
Expand Down

0 comments on commit 1f3ae09

Please sign in to comment.