-
Notifications
You must be signed in to change notification settings - Fork 11
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
base: main
Are you sure you want to change the base?
Conversation
authType -> roleType
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.
고생하셨습니다!
import { Home, Login, PageA, PageB, Manager, Admin, NotFound } from '../pages'; | ||
import { roleType } from '../types'; | ||
|
||
export const routes = [ |
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.
이런 방식으로 route를 관리하는 방식도 있군요. 공부됐어요 👍
.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; | ||
} |
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.
페이지가 많아졌을때를 고려해서 js는 잘 짜셨는데 css에서 overflow가 없어서 사이드바에 있는 메뉴가 많아지지 스크롤시 스타일이 이상하게 동작하더라구요. 한번 확인해주세요
SUCCESS: 'success', | ||
FAIL: 'fail', | ||
}; | ||
Object.freeze(loginResultType); |
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.
object.freeze의 기능을 한번 더 복습하는 시간이었어요 ㅎㅎ 👍
return { | ||
res: loginResultType.FAIL, | ||
data: await loginRes.json(), | ||
}; | ||
}; |
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없어도 요청에서 실패하면 여기서 잡히는지 궁금하네요.
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 }; |
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.
👍 👍 👍
구현 기능