From dcc5c65b268064c631e00d2ce19f5032f4029138 Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 03:57:26 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=E2=9C=A8feat:=20=ED=8C=80=EC=9B=90?= =?UTF-8?q?=EC=86=8C=EA=B0=9C=EC=84=9C=20=EB=A9=94=EC=9D=B8=20=EB=82=98?= =?UTF-8?q?=EC=99=80=20=EA=B4=80=EB=A0=A8=EB=90=9C=20=EC=9D=B4=EC=8A=88=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=20GET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/remote/team.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index c8bfc532..f9aa73c6 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -48,6 +48,8 @@ export function teamDataRemote(): TeamService { category: team.categoryName, createdAt: team.dates, content: team.content, + teamID: team.teamId, + issueCardImage: team.teamImage, teamName: team.teamname, memberName: team.username, })), From 49236fd9c47c3ac862b1d1d60dbc0494aa82aad5 Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 05:04:22 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=E2=9C=A8feat:=20=ED=8C=80=EC=9B=90?= =?UTF-8?q?=EC=86=8C=EA=B0=9C=EC=84=9C=20=EC=83=81=EC=84=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=8C=80=EC=9D=98=20=EC=9D=B4=EC=8A=88=20?= =?UTF-8?q?GET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/remote/team.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index f9aa73c6..fb530fd9 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -10,10 +10,26 @@ export function teamDataRemote(): TeamService { }; const getTeamIssue = async (teamID: string) => { - const response = await privateAPI.get({ url: `/team/detail/${teamID}` }); - if (response.status === 200) console.log(response.data); + const response = await privateAPI.get({ url: `/team/detail/${teamID}/issue` }); + 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 '서버 통신 실패'; - return TEAM_DATA.TEAM_ISSUE_INFO; }; const postFeedbackBookmark = async () => { From 74c89d20ee0eee5a04870c37aa8b9f19461e6633 Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 06:09:27 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=E2=9C=A8feat:=20=ED=8C=80=EC=9B=90?= =?UTF-8?q?=EC=86=8C=EA=B0=9C=EC=84=9C=20=EC=83=81=EC=84=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=8C=80=20=EC=A0=95=EB=B3=B4=20GET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/api/team.ts | 2 - src/infrastructure/api/types/team.ts | 1 + src/infrastructure/mock/team.data.ts | 1 + src/infrastructure/mock/team.ts | 6 --- src/infrastructure/remote/team.ts | 6 --- src/presentation/pages/Team/Main/index.tsx | 46 ++++++++++++---------- 6 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/infrastructure/api/team.ts b/src/infrastructure/api/team.ts index 2a48b9eb..66ad27ba 100644 --- a/src/infrastructure/api/team.ts +++ b/src/infrastructure/api/team.ts @@ -3,7 +3,6 @@ import { PostFeedbackBookmarkResponse, TeamProfileData, TeamIssueData, - TeamInfoData, TeamInviteData, } from './types/team'; @@ -13,6 +12,5 @@ export interface TeamService { getTeamProfile(): Promise; getMyIssue(): Promise; getTeamIssue(teamID: string): Promise; - getTeamInfo(teamID: string): Promise; getInviteInfo(): Promise; } diff --git a/src/infrastructure/api/types/team.ts b/src/infrastructure/api/types/team.ts index d04c1506..d8fed254 100644 --- a/src/infrastructure/api/types/team.ts +++ b/src/infrastructure/api/types/team.ts @@ -70,6 +70,7 @@ export type TeamInfoData = { teamImage?: string; teamName: string; teamDescription: string; + teamMemberCount: number; teamMemberList: TeamMemberNoneId[]; }; diff --git a/src/infrastructure/mock/team.data.ts b/src/infrastructure/mock/team.data.ts index ac0da5c1..415cf8f9 100644 --- a/src/infrastructure/mock/team.data.ts +++ b/src/infrastructure/mock/team.data.ts @@ -192,6 +192,7 @@ export const TEAM_DATA: { teamImage: 'https://cdn.pixabay.com/photo/2021/07/13/11/34/cat-6463284_1280.jpg', teamName: '너가소개서', teamDescription: '대학생연합 IT벤처창업 동아리', + teamMemberCount: 4, teamMemberList: [ { id: 1, diff --git a/src/infrastructure/mock/team.ts b/src/infrastructure/mock/team.ts index 9d00da51..c1f8aa17 100644 --- a/src/infrastructure/mock/team.ts +++ b/src/infrastructure/mock/team.ts @@ -27,11 +27,6 @@ export function teamDataMock(): TeamService { return TEAM_DATA.TEAM_ISSUE_INFO; }; - const getTeamInfo = async () => { - await wait(2000); - return TEAM_DATA.TEAM_DETAIL_INFO; - }; - const getInviteInfo = async () => { await wait(2000); return TEAM_DATA.TEAM_INVITE_INFO; @@ -43,7 +38,6 @@ export function teamDataMock(): TeamService { getTeamProfile, getMyIssue, getTeamIssue, - getTeamInfo, getInviteInfo, }; } diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index fb530fd9..2ec19821 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -73,11 +73,6 @@ export function teamDataRemote(): TeamService { else throw '서버 통신 실패'; }; - const getTeamInfo = async () => { - await wait(2000); - return TEAM_DATA.TEAM_DETAIL_INFO; - }; - const getInviteInfo = async () => { const response = await privateAPI.get({ url: `/team/invite` }); if (response.status === 200) @@ -95,7 +90,6 @@ export function teamDataRemote(): TeamService { getTeamProfile, getMyIssue, getTeamIssue, - getTeamInfo, getInviteInfo, getIssueInfo, }; diff --git a/src/presentation/pages/Team/Main/index.tsx b/src/presentation/pages/Team/Main/index.tsx index dd252d76..5f911bfd 100644 --- a/src/presentation/pages/Team/Main/index.tsx +++ b/src/presentation/pages/Team/Main/index.tsx @@ -1,42 +1,52 @@ import { useNavigate, useParams } from 'react-router-dom'; import { StTeamMain, StTeamInfo, StCheckWrapper } from './style'; -import { icPerson, icPlusMini, icCoralCheck, icGrayCheck } from '@assets/icons'; +import { icPerson, icCoralCheck, icGrayCheck } from '@assets/icons'; import IssueCardList from '@components/common/IssueCardList'; import { useState, useEffect } from 'react'; import { api } from '@api/index'; import { TeamInfoData, TeamIssueCard } from '@api/types/team'; import { imgEmptyProfile } from '@assets/images'; import TeamMemberPopup from './MemberPopup'; +import { privateAPI } from '@infrastructure/remote/base'; function TeamMain() { const [isMemberPopupOpened, setIsMemberPopupOpened] = useState(false); const [isChecked, setIsChecked] = useState(false); - const [teamInfoData, setTeamInfoData] = useState(null); + const [teamInfoData, setTeamInfoData] = useState(undefined); const [issueListData, setIssueListData] = useState(null); - const [isValidating, setIsValidating] = useState(false); const { teamID } = useParams(); const navigate = useNavigate(); useEffect(() => { (async () => { - setIsValidating(true); if (teamID === undefined) return; - const teamDetailData = await api.teamService.getTeamInfo(teamID); + const response = await privateAPI.get({ url: `/team/detail/${teamID}` }); + if (response.status === 200) + setTeamInfoData({ + teamID: response.data.team.id, + teamImage: response.data.team.image ?? imgEmptyProfile, + teamName: response.data.team.name, + teamDescription: response.data.team.description, + teamMemberCount: response.data.memberCount, + teamMemberList: response.data.member.map((memberDetail: any) => ({ + id: memberDetail.id, + profileName: memberDetail.name, + profileImage: memberDetail.image ?? imgEmptyProfile, + })), + }); + })(); + }, []); + + useEffect(() => { + (async () => { + if (teamID === undefined) return; const { issueListData } = await api.teamService.getTeamIssue(teamID); - setTeamInfoData(teamDetailData); setIssueListData(issueListData); - setIsValidating(false); })(); - - return () => { - setTeamInfoData(null); - setIssueListData(null); - }; }, []); return ( - {isValidating &&
로딩중
} {teamInfoData && (
@@ -48,13 +58,13 @@ function TeamMain() {

{teamInfoData.teamMemberList.map((member, index) => ( {member.profileName} - {index < teamInfoData.teamMemberList.length - 1 ? ',\u00a0' : ''} + {index < teamInfoData.teamMemberCount - 1 ? ',\u00a0' : ''} ))}

@@ -62,17 +72,13 @@ function TeamMain() {
)} - + 나와 관련된 이슈만 보기 - {isValidating &&
로딩중
} {issueListData && ( Date: Wed, 19 Jan 2022 06:16:14 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=F0=9F=93=9Dchore:=20getMyIssue=EC=97=90?= =?UTF-8?q?=EC=84=9C=20getMyTeamIssue=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/api/team.ts | 2 +- src/infrastructure/mock/team.ts | 4 ++-- src/infrastructure/remote/team.ts | 4 ++-- src/presentation/pages/Home/Team/index.tsx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/infrastructure/api/team.ts b/src/infrastructure/api/team.ts index 66ad27ba..26854cd2 100644 --- a/src/infrastructure/api/team.ts +++ b/src/infrastructure/api/team.ts @@ -10,7 +10,7 @@ export interface TeamService { getIssueInfo(teamID: string, issueID: string): Promise; postFeedbackBookmark(feedbackID: string): Promise; getTeamProfile(): Promise; - getMyIssue(): Promise; + getMyTeamIssue(): Promise; getTeamIssue(teamID: string): Promise; getInviteInfo(): Promise; } diff --git a/src/infrastructure/mock/team.ts b/src/infrastructure/mock/team.ts index c1f8aa17..036b39b8 100644 --- a/src/infrastructure/mock/team.ts +++ b/src/infrastructure/mock/team.ts @@ -17,7 +17,7 @@ export function teamDataMock(): TeamService { return TEAM_DATA.TEAM_PROFILE; }; - const getMyIssue = async () => { + const getMyTeamIssue = async () => { await wait(2000); return TEAM_DATA.TEAM_ISSUE_INFO; }; @@ -36,7 +36,7 @@ export function teamDataMock(): TeamService { getIssueInfo, postFeedbackBookmark, getTeamProfile, - getMyIssue, + getMyTeamIssue, getTeamIssue, getInviteInfo, }; diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index 2ec19821..eb3ff0c0 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -50,7 +50,7 @@ export function teamDataRemote(): TeamService { else throw '서버 통신 실패'; }; - const getMyIssue = async () => { + const getMyTeamIssue = async () => { const response = await privateAPI.get({ url: `/team/issue` }); if (response.status === 200) return { @@ -88,7 +88,7 @@ export function teamDataRemote(): TeamService { return { postFeedbackBookmark, getTeamProfile, - getMyIssue, + getMyTeamIssue, getTeamIssue, getInviteInfo, getIssueInfo, diff --git a/src/presentation/pages/Home/Team/index.tsx b/src/presentation/pages/Home/Team/index.tsx index 45328269..e9d8b7b6 100644 --- a/src/presentation/pages/Home/Team/index.tsx +++ b/src/presentation/pages/Home/Team/index.tsx @@ -23,7 +23,7 @@ function HomeTeam() { useEffect(() => { (async () => { - const { issueListData } = await api.teamService.getMyIssue(); + const { issueListData } = await api.teamService.getMyTeamIssue(); setIssueListData(issueListData); })(); }, []); From 1f3ae095f1dfe57bc1d540ae78db76e7dea6b6f2 Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 07:19:57 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=E2=9C=A8feat:=20=ED=8C=80=EC=9B=90?= =?UTF-8?q?=EC=86=8C=EA=B0=9C=EC=84=9C=20=EC=83=81=EC=84=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=82=98=EC=99=80=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=EB=90=9C=20=EC=9D=B4=EC=8A=88=20GET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/api/team.ts | 1 + src/infrastructure/mock/team.ts | 6 ++++++ src/infrastructure/remote/team.ts | 24 ++++++++++++++++++++++ src/presentation/pages/Team/Main/index.tsx | 21 +++++++++++++++++-- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/infrastructure/api/team.ts b/src/infrastructure/api/team.ts index 26854cd2..5558c5e9 100644 --- a/src/infrastructure/api/team.ts +++ b/src/infrastructure/api/team.ts @@ -12,5 +12,6 @@ export interface TeamService { getTeamProfile(): Promise; getMyTeamIssue(): Promise; getTeamIssue(teamID: string): Promise; + getMyIssue(teamID:string): Promise; getInviteInfo(): Promise; } diff --git a/src/infrastructure/mock/team.ts b/src/infrastructure/mock/team.ts index 036b39b8..dafe5129 100644 --- a/src/infrastructure/mock/team.ts +++ b/src/infrastructure/mock/team.ts @@ -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; @@ -38,6 +43,7 @@ export function teamDataMock(): TeamService { getTeamProfile, getMyTeamIssue, getTeamIssue, + getMyIssue, getInviteInfo, }; } diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index eb3ff0c0..71306af1 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -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 }; @@ -90,6 +113,7 @@ export function teamDataRemote(): TeamService { getTeamProfile, getMyTeamIssue, getTeamIssue, + getMyIssue, getInviteInfo, getIssueInfo, }; diff --git a/src/presentation/pages/Team/Main/index.tsx b/src/presentation/pages/Team/Main/index.tsx index 5f911bfd..5426f0ba 100644 --- a/src/presentation/pages/Team/Main/index.tsx +++ b/src/presentation/pages/Team/Main/index.tsx @@ -36,7 +36,7 @@ function TeamMain() { }); })(); }, []); - + useEffect(() => { (async () => { if (teamID === undefined) return; @@ -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 ( {teamInfoData && ( @@ -74,7 +91,7 @@ function TeamMain() { )} - 나와 관련된 이슈만 보기 From 0e3bb1d56296ddfe1d4c71ecea3a13ceb713f8b3 Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 17:48:24 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=F0=9F=94=A8refactor:=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/presentation/pages/Team/Main/index.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/presentation/pages/Team/Main/index.tsx b/src/presentation/pages/Team/Main/index.tsx index 5426f0ba..83aff0b1 100644 --- a/src/presentation/pages/Team/Main/index.tsx +++ b/src/presentation/pages/Team/Main/index.tsx @@ -16,6 +16,7 @@ function TeamMain() { const [issueListData, setIssueListData] = useState(null); const { teamID } = useParams(); const navigate = useNavigate(); + const checkMyIssue = () => setIsChecked((prev) => !prev); useEffect(() => { (async () => { @@ -45,22 +46,20 @@ function TeamMain() { })(); }, []); - const checkMyIssue = () => { - setIsChecked(!isChecked); + useEffect(() => { + if (teamID === undefined) return; 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); })(); } - }; + }, [isChecked, teamID]); return ( From 1f4d6c9b7f50dd55259e86117f12123f177d6b74 Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 20:41:10 +0900 Subject: [PATCH 7/9] =?UTF-8?q?=F0=9F=94=A8refactor:=20api=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=ED=95=B4=EC=84=9C=20=EC=B6=94=EC=83=81?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/api/team.ts | 2 + src/infrastructure/api/types/team.ts | 14 ++++-- src/infrastructure/mock/team.data.ts | 54 ++++++++++++---------- src/infrastructure/mock/team.ts | 6 +++ src/infrastructure/remote/team.ts | 22 +++++++++ src/presentation/pages/Team/Main/index.tsx | 31 ++++--------- 6 files changed, 78 insertions(+), 51 deletions(-) diff --git a/src/infrastructure/api/team.ts b/src/infrastructure/api/team.ts index 5558c5e9..2cb369cc 100644 --- a/src/infrastructure/api/team.ts +++ b/src/infrastructure/api/team.ts @@ -3,6 +3,7 @@ import { PostFeedbackBookmarkResponse, TeamProfileData, TeamIssueData, + TeamInfoData, TeamInviteData, } from './types/team'; @@ -11,6 +12,7 @@ export interface TeamService { postFeedbackBookmark(feedbackID: string): Promise; getTeamProfile(): Promise; getMyTeamIssue(): Promise; + getTeamInfo(teamID: number): Promise; getTeamIssue(teamID: string): Promise; getMyIssue(teamID:string): Promise; getInviteInfo(): Promise; diff --git a/src/infrastructure/api/types/team.ts b/src/infrastructure/api/types/team.ts index d8fed254..30fd7288 100644 --- a/src/infrastructure/api/types/team.ts +++ b/src/infrastructure/api/types/team.ts @@ -65,13 +65,19 @@ export type TeamProfileData = { profileListData: TeamMemberNoneId[]; }; -export type TeamInfoData = { - teamID: string; +export type TeamDetail = { + teamID: number; teamImage?: string; teamName: string; teamDescription: string; - teamMemberCount: number; - teamMemberList: TeamMemberNoneId[]; +}; + +export type TeamInfoData = { + teamDetailData: { + teamDetail: TeamDetail; + teamMemberCount: number; + teamMemberList: TeamMemberNoneId[]; + }; }; export type TeamInvite = { diff --git a/src/infrastructure/mock/team.data.ts b/src/infrastructure/mock/team.data.ts index 415cf8f9..58af227c 100644 --- a/src/infrastructure/mock/team.data.ts +++ b/src/infrastructure/mock/team.data.ts @@ -188,32 +188,36 @@ export const TEAM_DATA: { ], }, TEAM_DETAIL_INFO: { - teamID: '0', - teamImage: 'https://cdn.pixabay.com/photo/2021/07/13/11/34/cat-6463284_1280.jpg', - teamName: '너가소개서', - teamDescription: '대학생연합 IT벤처창업 동아리', - teamMemberCount: 4, - teamMemberList: [ - { - id: 1, - profileName: '캐서린', - }, - { - id: 12, - profileName: '웬디', - profileImage: 'https://cdn.pixabay.com/photo/2014/11/30/14/11/cat-551554_1280.jpg', - }, - { - id: 13, - profileName: '콩콩이', - profileImage: 'https://cdn.pixabay.com/photo/2014/11/30/14/11/cat-551554_1280.jpg', - }, - { - id: 14, - profileName: '크왕', - profileImage: 'https://cdn.pixabay.com/photo/2014/11/30/14/11/cat-551554_1280.jpg', + teamDetailData: { + teamDetail: { + teamID: 1, + teamImage: 'https://cdn.pixabay.com/photo/2021/07/13/11/34/cat-6463284_1280.jpg', + teamName: '너가소개서', + teamDescription: '대학생연합 IT벤처창업 동아리', }, - ], + teamMemberCount: 4, + teamMemberList: [ + { + id: 1, + profileName: '캐서린', + }, + { + id: 12, + profileName: '웬디', + profileImage: 'https://cdn.pixabay.com/photo/2014/11/30/14/11/cat-551554_1280.jpg', + }, + { + id: 13, + profileName: '콩콩이', + profileImage: 'https://cdn.pixabay.com/photo/2014/11/30/14/11/cat-551554_1280.jpg', + }, + { + id: 14, + profileName: '크왕', + profileImage: 'https://cdn.pixabay.com/photo/2014/11/30/14/11/cat-551554_1280.jpg', + }, + ], + }, }, TEAM_INVITE_INFO: { inviteListData: [ diff --git a/src/infrastructure/mock/team.ts b/src/infrastructure/mock/team.ts index dafe5129..c65dabc3 100644 --- a/src/infrastructure/mock/team.ts +++ b/src/infrastructure/mock/team.ts @@ -17,6 +17,11 @@ export function teamDataMock(): TeamService { return TEAM_DATA.TEAM_PROFILE; }; + const getTeamInfo = async () => { + await wait(2000); + return TEAM_DATA.TEAM_DETAIL_INFO; + }; + const getMyTeamIssue = async () => { await wait(2000); return TEAM_DATA.TEAM_ISSUE_INFO; @@ -41,6 +46,7 @@ export function teamDataMock(): TeamService { getIssueInfo, postFeedbackBookmark, getTeamProfile, + getTeamInfo, getMyTeamIssue, getTeamIssue, getMyIssue, diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index 71306af1..188b8121 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -73,6 +73,27 @@ export function teamDataRemote(): TeamService { else throw '서버 통신 실패'; }; + const getTeamInfo = async (teamID: number) => { + const response = await privateAPI.get({ url: `/team/detail/${teamID}` }); + if (response.status === 200) + return { + teamDetailData: { + teamDetail: { + teamID: response.data.team.id, + teamImage: response.data.team.image ?? imgEmptyProfile, + teamName: response.data.team.name, + teamDescription: response.data.team.description, + }, + teamMemberCount: response.data.memberCount, + teamMemberList: response.data.member.map((memberDetail: any) => ({ + id: memberDetail.id, + profileName: memberDetail.name, + profileImage: memberDetail.image ?? imgEmptyProfile, + })), + }, + }; + }; + const getMyTeamIssue = async () => { const response = await privateAPI.get({ url: `/team/issue` }); if (response.status === 200) @@ -111,6 +132,7 @@ export function teamDataRemote(): TeamService { return { postFeedbackBookmark, getTeamProfile, + getTeamInfo, getMyTeamIssue, getTeamIssue, getMyIssue, diff --git a/src/presentation/pages/Team/Main/index.tsx b/src/presentation/pages/Team/Main/index.tsx index 83aff0b1..b53071ed 100644 --- a/src/presentation/pages/Team/Main/index.tsx +++ b/src/presentation/pages/Team/Main/index.tsx @@ -7,7 +7,6 @@ import { api } from '@api/index'; import { TeamInfoData, TeamIssueCard } from '@api/types/team'; import { imgEmptyProfile } from '@assets/images'; import TeamMemberPopup from './MemberPopup'; -import { privateAPI } from '@infrastructure/remote/base'; function TeamMain() { const [isMemberPopupOpened, setIsMemberPopupOpened] = useState(false); @@ -21,20 +20,8 @@ function TeamMain() { useEffect(() => { (async () => { if (teamID === undefined) return; - const response = await privateAPI.get({ url: `/team/detail/${teamID}` }); - if (response.status === 200) - setTeamInfoData({ - teamID: response.data.team.id, - teamImage: response.data.team.image ?? imgEmptyProfile, - teamName: response.data.team.name, - teamDescription: response.data.team.description, - teamMemberCount: response.data.memberCount, - teamMemberList: response.data.member.map((memberDetail: any) => ({ - id: memberDetail.id, - profileName: memberDetail.name, - profileImage: memberDetail.image ?? imgEmptyProfile, - })), - }); + const teamDetailData = await api.teamService.getTeamInfo(Number(teamID)); + setTeamInfoData(teamDetailData); })(); }, []); @@ -68,23 +55,23 @@ function TeamMain() {
- +
-

{teamInfoData.teamName}

+

{teamInfoData.teamDetailData.teamDetail.teamName}

- {teamInfoData.teamMemberList.map((member, index) => ( + {teamInfoData.teamDetailData.teamMemberList.map((member, index) => ( {member.profileName} - {index < teamInfoData.teamMemberCount - 1 ? ',\u00a0' : ''} + {index < teamInfoData.teamDetailData.teamMemberCount - 1 ? ',\u00a0' : ''} ))}

-

{teamInfoData.teamDescription}

+

{teamInfoData.teamDetailData.teamDetail.teamDescription}

)} From 039cabac95762507ce0be54aaa4acabd4b750926 Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 20:58:17 +0900 Subject: [PATCH 8/9] =?UTF-8?q?=F0=9F=94=A8refactor:=20=EB=B9=88=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=EC=9D=B8=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/api/team.ts | 2 +- src/infrastructure/remote/team.ts | 84 +++++++++++++++++-------------- 2 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/infrastructure/api/team.ts b/src/infrastructure/api/team.ts index 2cb369cc..634d9ad4 100644 --- a/src/infrastructure/api/team.ts +++ b/src/infrastructure/api/team.ts @@ -12,7 +12,7 @@ export interface TeamService { postFeedbackBookmark(feedbackID: string): Promise; getTeamProfile(): Promise; getMyTeamIssue(): Promise; - getTeamInfo(teamID: number): Promise; + getTeamInfo(teamID: number): Promise; getTeamIssue(teamID: string): Promise; getMyIssue(teamID:string): Promise; getInviteInfo(): Promise; diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index e35c658c..4e104851 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -4,6 +4,11 @@ import { TEAM_DATA } from '../mock/team.data'; import { privateAPI } from './base'; export function teamDataRemote(): TeamService { + const postFeedbackBookmark = async () => { + await wait(1000); + return { isSuccess: true }; + }; + const getIssueInfo = async () => { await wait(2000); return TEAM_DATA.ISSUE_INFO; @@ -13,21 +18,23 @@ export function teamDataRemote(): TeamService { const response = await privateAPI.get({ url: `/team/detail/${teamID}/issue` }); 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, - })), + issueListData: response.data + ? 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 '서버 통신 실패'; }; @@ -36,30 +43,27 @@ export function teamDataRemote(): TeamService { 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, - })), + issueListData: response.data + ? 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 }; - }; - const getTeamProfile = async () => { const response = await privateAPI.get({ url: `/team` }); if (response.status === 200) @@ -124,10 +128,12 @@ export function teamDataRemote(): TeamService { const response = await privateAPI.get({ url: `/team/invite` }); if (response.status === 200) return { - inviteListData: response.data.map((team: any) => ({ - id: team.id, - name: team.name, - })), + inviteListData: response.data + ? response.data.map((team: any) => ({ + id: team.id, + name: team.name, + })) + : [], }; else throw '서버 통신 실패'; }; From 76cc54f73de1256ef6f85be829b692572212b41c Mon Sep 17 00:00:00 2001 From: 100Gyeon Date: Wed, 19 Jan 2022 20:59:05 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=93=9Dchore:=20console.log=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/infrastructure/remote/team.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/infrastructure/remote/team.ts b/src/infrastructure/remote/team.ts index 4e104851..b9f27065 100644 --- a/src/infrastructure/remote/team.ts +++ b/src/infrastructure/remote/team.ts @@ -102,7 +102,6 @@ export function teamDataRemote(): TeamService { const getMyTeamIssue = async () => { const response = await privateAPI.get({ url: `/team/issue` }); - console.log(response); if (response.status === 200) return { issueListData: response.data