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

로그인 상태/라운지 참여여부 #114

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

JJongsKim
Copy link
Contributor

@JJongsKim JJongsKim commented Jul 25, 2022

No description provided.


// 로그인 하지 않은 상태로 라운지 진입시
useEffect(() => {
if (!getCookie('jwt')) Router.push('/sign-in');
Copy link
Member

Choose a reason for hiding this comment

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

이 부분 서버 담당자분인 @ypd06021 님과 이야기해보셔야 할 것 같습니다.
현재 jwt 라는 이름의 쿠키만 가지면 페이지가 들어가지는데, 개발자도구 켜서 jwt라는 이름의 쿠키를 만들어서 들어가면 어떡하죠?
서버에서 막던지 방법을 이야기하고 슬랙에 결론을 공유해주세요!
@yuraup pm님 우선 태그하겠습니다~

Copy link
Contributor

Choose a reason for hiding this comment

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

검증은 서버에서 하는중일듯?

src/pages/lounge/index.tsx Outdated Show resolved Hide resolved
@syeon2565 syeon2565 mentioned this pull request Jul 27, 2022
6 tasks
Comment on lines 43 to 67
const statusVerify = async () => {
try {
// 내가 소속된 라운지 리스트
const loungeList = await Axios.get(`https://api.liontown.city/api/lounges`, {
withCredentials: true,
});
// 선택한 라운지 정보 -> {id} 부분에 임시로 값 넣음
const selectLounge = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, {
withCredentials: true,
});
// console.log(selectLounge.data.data.roomData);
// 내가 소속된 라운지 리스트명과 선택한 라운지가 같지 않을 때
// 혹은 해당 라운지가 없는 경우 라운지 생성페이지로 보내기
if (
loungeList.data.data[0].name !== selectLounge.data.data.loungeName.name ||
selectLounge.status === 404
) {
useRouter.push('/lounge-select');
setTimeout(() => returnLoungeSelect(), 2000);
}
} catch (err) {
// console.log 없앨 예정 ..
console.log('error');
}
};
Copy link
Contributor

@Bhanjo Bhanjo Aug 11, 2022

Choose a reason for hiding this comment

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

get 요청은 리액트 쿼리를 써주세요
api 패치를 한번에 두 개를 하는데 이 둘을 동기적으로 다룰 것이 아니라면 분리해주세요

src/pages/lounge/index.tsx Outdated Show resolved Hide resolved
selectLounge.status === 404
) {
useRouter.push('/lounge-select');
setTimeout(() => returnLoungeSelect(), 2000);
Copy link
Member

Choose a reason for hiding this comment

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

clear함수가 필요해보여요~

src/components/lounge/LoungeDoor.tsx Outdated Show resolved Hide resolved
Comment on lines +57 to +64
useEffect(() => {
if (getCookie('jwt')) {
router.push('/sign-in');
returnMessage();
} else {
statusVerify();
}
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

httpOnly 설정으로 인해 프론트에서 쿠키 조작 불가합니다 axios나 리액트 쿼리에서 에러 핸들러로 로그인 검증 해주세요~

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.

5 participants