-
Notifications
You must be signed in to change notification settings - Fork 46
[ Team-17 / Ah-puh / FE ] API 적용 #23
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
Conversation
[FE] 글로벌 백그라운드 이미지 삽입 및 포지셔닝 resolve #21
인트로 하위 컴포넌트인 TeamSelect, Game 추가 react-router-dom 설치
[FE] Intro 컴포넌트 완료
[FE] : Pitch 결과 산출 함수 추가
Main을별개의 컴포넌트로 만들까? 구디에게 물어볼 것
InGame 어두워 지는 효과도 구현, LineUp 구현 때 재활용 가능할 듯
표 부분 fetch 및 parse 기능 제외한 스타일만 구현
[FE] 가운데 정렬 및 ScoreBoard 컴포넌트 일부 구현
[FE] ScoreBoard / LineUp fetch
pitcher_windup.png 크기조정, Main.jsx 생성에 따른 import 경로 수정
[FE] useContext 적용
Fe/feature/redirect
Co-authored-by: junzero741 <junzero741@users.noreply.github.com>
[FE] Ground /game API 적용
[FE] 인게임 레코드 데이터 fetch 결과 구현
crongro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
열코하셨군요~
노력의 흔적이 보여서 좋았네요.
리뷰 참고하세요~
| const { loginStatus, setLoginStatus, userId, setUserId } = useContext(MainContext); | ||
|
|
||
| const handleOnClick = async (provider) => { | ||
| const res = await socialMediaAuth(provider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드 들여쓰기가 꽤 깊네요?
| const { loginStatus, setLoginStatus, userId, setUserId } = useContext(MainContext); | ||
|
|
||
| const handleOnClick = async (provider) => { | ||
| const res = await socialMediaAuth(provider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
비동기 코드 구현시 습관적으로 try/catch 처리를 해보시면 좋겠어요.
catch 에서는 사용자에게 적절한 메시지를 보여주면 좋겠고요.(console로 노출하는것 말고, 별도 뷰에서 메시지를 노출)
|
|
||
| const handleOnClick = async (provider) => { | ||
| const res = await socialMediaAuth(provider); | ||
| if (res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res 가 true/false로 오나요? 아니면 res.ok 값이 혹시 있는건 아니죠?
| } | ||
| }; | ||
| const getOnlyId = (email) => { | ||
| const arr = email.split("@"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arr은 맥락이 없는 이름이네요. 좀더 구체적인 이름으로.
id를 뽑는 것이면 getId라고만 해도 될 듯.
또는 이렇게 파라미터까지 이어져서 풀네이밍이 되도록~
const getIdBy = (email) => {}
| </Link> | ||
| <Login> | ||
| {loginStatus ? ( | ||
| <></> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
삼항연산자보다 && 를 사용하면 더 간단해질 듯 합니다.
| const baseLocation = [ | ||
| { base: 0, top: "560px", left: "492px" }, | ||
| { base: 1, top: "318px", left: "631px" }, | ||
| { base: 2, top: "144px", left: "407px" }, | ||
| { base: 3, top: "357px", left: "253px" }, | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 객체로 정의해서 관리하는 것은 좋네요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top, left 값이 어떤 공식에 의해서 결정되면 매우 훌륭할텐데 말이죠.
(가능한지 모름)
| const { gameId, teamId, loginStatus } = useContext(MainContext); | ||
|
|
||
| const [data, setData] = useState(); | ||
| const reloadData = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 코드는 useEffect 안으로 옮겨서 선언해도 될 듯.
| toggle(true); | ||
| setDark(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggle과 dark가 fetching이후에 처리되는거 맞죠?
| console.log("fetch error in TeamSelect : ", error); | ||
| setAlertMessage("게임 목록을 불러올 수 없습니다") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에리 처리 좋고요.
실제로 에러 상황을 재현해서 테스트도 해보세요.
| ); | ||
| }; | ||
|
|
||
| const RouterComponent = () => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요렇게 하시면 더 좋을 듯.
state가 변경될때, Main컴포넌트 하위에 있는 컴포넌트들 중에 context의 상태에 의존하지 않는 컴포넌트들은,
불필요하게 re-rendering 이 되지 않습니다.
const Main = () => {
<MainContextProvider>
<switch><route></route>.....</switch>
</MainContextProvider>
}
const MainContexProvider = (props) => {
const [gameId, setGameId] = useState();
const [teamId, setTeamId] = useState();
const [loginStatus, setLoginStatus] = useState(false);
const [userId, setUserId] = useState();
return (
<MainContext.Provider value={{ gameId, setGameId, teamId, setTeamId, loginStatus, setLoginStatus, userId, setUserId }}>
<StyledMain>
{props.children}
</StyledMain>
</MainContext.Provider>
);
}useFetch _ useState 관리 상태 1개로 정리.
- ViewDidAppear 시점에서 layer 구성하도록 변경
현재까지의 작업 상황
API
앞으로 작업할 것
진루 애니메이션
Home