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

온보딩 프로젝트 2단계 제출 #2

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open

온보딩 프로젝트 2단계 제출 #2

wants to merge 39 commits into from

Conversation

yoouyeon
Copy link
Member

구현 기능

  • login, logout
  • 계정 유효성 검사
  • 권한별 routing page
  • 로그인 유지

Copy link
Contributor

@mike2ox mike2ox left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

import { Home, Login, PageA, PageB, Manager, Admin, NotFound } from '../pages';
import { roleType } from '../types';

export const routes = [
Copy link
Contributor

Choose a reason for hiding this comment

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

이런 방식으로 route를 관리하는 방식도 있군요. 공부됐어요 👍

Comment on lines +3 to +11
.wrapper {
@include flex-column;
position: absolute;
top: $header-height;
left: 0;
width: $sidebar-width;
height: $body-height;
border-right: $section-border-weight solid $dark-blue;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

페이지가 많아졌을때를 고려해서 js는 잘 짜셨는데 css에서 overflow가 없어서 사이드바에 있는 메뉴가 많아지지 스크롤시 스타일이 이상하게 동작하더라구요. 한번 확인해주세요

SUCCESS: 'success',
FAIL: 'fail',
};
Object.freeze(loginResultType);
Copy link
Contributor

Choose a reason for hiding this comment

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

object.freeze의 기능을 한번 더 복습하는 시간이었어요 ㅎㅎ 👍

Comment on lines +20 to +24
return {
res: loginResultType.FAIL,
data: await loginRes.json(),
};
};
Copy link
Contributor

Choose a reason for hiding this comment

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

try-catch없어도 요청에서 실패하면 여기서 잡히는지 궁금하네요.

Comment on lines +5 to +36
export function useUser() {
const [user, setUser] = useRecoilState(userState);
const resetUser = useResetRecoilState(userState);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(false);

useEffect(() => {
async function fetchUser() {
try {
const res = await fetch('/user', {
method: 'GET',
headers: {
credentials: 'include',
},
});
if (!res.ok) {
throw new Error('Failed to load user');
}
const user = await res.json();
setUser(user);
setLoading(false);
} catch (e) {
setError(true);
setLoading(false);
}
}
if (user) {
return;
}
fetchUser();
}, [user]);
return { user, loading, error, resetUser };
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 👍 👍

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.

2 participants