Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

팀원소개서 메인 일부, 상세 페이지 실서버 API 붙이기 #114

Merged
merged 12 commits into from
Jan 19, 2022

Conversation

100Gyeon
Copy link
Member

@100Gyeon 100Gyeon commented Jan 18, 2022

⛓ Related Issues

📋 작업 내용

  • [팀원소개서 메인] 나와 관련된 이슈 확인 GET
  • [팀원소개서 상세] 팀 정보 GET
  • [팀원소개서 상세] 팀 이슈 목록 GET
  • [팀원소개서 상세] 나와 관련된 이슈만 보기 GET

📌 PR Point

  • 나와 관련된 이슈만 볼 수 있게 버튼 클릭하는 부분(checkMyIssue)의 코드가 마음에 들지 않네요..

👀 스크린샷 / GIF / 링크

메인 페이지 : https://naegasogaeseo-dev.kro.kr/home/team

상세 페이지 : https://naegasogaeseo-dev.kro.kr/team/1

메인 페이지 상세 페이지

@100Gyeon 100Gyeon self-assigned this Jan 18, 2022
@100Gyeon 100Gyeon added the feature 🎄 기능 개발 label Jan 18, 2022
@100Gyeon 100Gyeon added this to In progress in 팀원소개서 via automation Jan 18, 2022
@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

Copy link
Member

@SeojinSeojin SeojinSeojin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

밤 늦게까지 넘 수고 많았으 👏👏

TeamInviteData,
} from './types/team';

export interface TeamService {
getIssueInfo(teamID: string, issueID: string): Promise<IssueData>;
postFeedbackBookmark(feedbackID: string): Promise<PostFeedbackBookmarkResponse>;
getTeamProfile(): Promise<TeamProfileData>;
getMyIssue(): Promise<TeamIssueData>;
getMyTeamIssue(): Promise<TeamIssueData>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이름 바꾼거 아주 조아요!

const response = await privateAPI.get({ url: `/team/detail/${teamID}/issue/my` });
if (response.status === 200)
return {
issueListData: response.data.map((team: any) => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바꾼거 엄청 많네.. 수고하셨습니당

if (teamID === undefined) return;
const teamDetailData = await api.teamService.getTeamInfo(teamID);
const response = await privateAPI.get({ url: `/team/detail/${teamID}` });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 받는 과정을 api로 추상화하고 컴포넌트에선 기냥 쓰는건 어떨까유..?

api에는 teamID 값만 던져주고 리턴값을 이렇게 컴포넌트에서 쓰이는 값으로 바꾸는 건 api 단에서 하는 게 좋을 것 같아요!!

만약 목데이터 쓰기가 번거로워서 그랬다면 내가 써주께..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래의 getTeamIssue 했던 것처럼 api로 분리해서 추상화하는게 좋을 것 같아유!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정완료 ~~! 고마웡

Comment on lines 48 to 63
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);
})();
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkMyIssue 함수에서는 setIsChecked만 바꿔주고,

isChecked의 변화에 대한 콜백 함수는 useEffect안에서 돌려주면 좋을 것 같아유!

그리고 set할 때도 상태에 직접적으로 접근하기보다는 원래 값을 바꾸는 식이 더 좋을 것 같아유!

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 여기서 if else 분기 처리하는게 마음에 안 들었던 거라면

#90

여기서 url에 쓰이는 viewMode 또한 인자로 받은 걸 참고해서 코드를 수정해보면 좋을듯!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 좋아좋아 고마워 !!

Copy link
Member

@NamJwong NamJwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

@SeojinSeojin
Copy link
Member

울 웹쁜이 고생많았어 ! 여기서 미리보기로 보면서 쉬어~ 다른 웹쁜이들한테도 자랑해줘~

Copy link
Member

@SeojinSeojin SeojinSeojin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!!!!

@100Gyeon 100Gyeon merged commit 78091e3 into dev Jan 19, 2022
팀원소개서 automation moved this from In progress to Done Jan 19, 2022
@100Gyeon 100Gyeon deleted the feat/#113 branch January 19, 2022 12:40
@100Gyeon 100Gyeon added this to Done in 웹 칸반 보드 Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎄 기능 개발
Development

Successfully merging this pull request may close these issues.

팀원소개서 메인 일부, 상세 페이지 실서버 API 붙이기
4 participants