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

FEAT: MatchList 컴포넌트에서 데이터를 가져와서 뿌리는 함수 작업. #72

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

polarb-raf
Copy link
Collaborator

fetchList 함수를 통해 데이터를 가져오고, useEffect, usestate로 상태 관리하도록 설정.

관련 이슈

개발 내용 요약

  • 조건에 상관없이 일단 모든 매치 정보를 가져오는 쿼리 붙여봤습니다. 필씅

fetchList 함수를 통해 데이터를 가져오고, useEffect, usestate로 상태 관리하도록 설정.
Comment on lines +45 to +51
key={match.seq}
hostSeq={match.host.seq}
hostName={match.host.seq}
stadium={match.stadium}
date={match.date}
startTime={match.startTime}
endTime={match.endTime}
Copy link
Contributor

Choose a reason for hiding this comment

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

props로 match만 보내는 방법은 어떨까요?
(key 제외)

Comment on lines +9 to +23
const gqlQuery = {
query: `{
PendingMatches{
seq
host{
seq
name
}
stadium
date
startTime
endTime
}
}`
};
Copy link
Contributor

Choose a reason for hiding this comment

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

우리도 이렇게 섹시한 쿼리를 사용할 수 있다니.. 옹기갓

import { Button } from '../../common';
import './index.scss';

const MatchList = () => {

Copy link
Contributor

Choose a reason for hiding this comment

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

line 6. 의도가 있는 개행일까요

Copy link
Contributor

@eastgerm eastgerm left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~!~!

Comment on lines +26 to +33
const data = await fetch('http://localhost:4000/graphql',{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(gqlQuery)
});
const result = await data.json();
Copy link
Contributor

Choose a reason for hiding this comment

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

util로 이 부분을 박아 놓으면 추후에 중복 제거하는 데에 좋을 것 같습니다.

Copy link
Contributor

@samrho samrho Nov 26, 2019

Choose a reason for hiding this comment

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

async processQuery(gqlQuery) {
 // ...
 return await data.json();
}

어차피 똑같은 주소에 method, headers 다 똑같을 것 같은데 요런 느낌?


const [ matchList, setMatchList ] = useState([]);

const gqlQuery = {
Copy link
Contributor

Choose a reason for hiding this comment

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

나중에 쿼리가 많아지면 따로 관리해야 될 것 같습니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

gqlQuery가 아닌 매치 리스트들을 가져오는거니깐 GET_MATCH_LIST_QUERY ? 요런식으로 네이밍하는것도 좋을 것 같습니다 :)

@polarb-raf polarb-raf merged commit 463b6b5 into connect-foundation:develop Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants