Skip to content

Commit

Permalink
FIX : View 단에서 옵셔널 체이닝 지양, Model에서 에러 발생시 init처리
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubinquitous committed Apr 9, 2023
1 parent 04228db commit 367a5fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions layout/MyPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const MyPageLayout = ({ user, mutate }: MyPageLayoutPropsType) => {
)}
</S.MyPageInfoLoadWrap>
</AccodianMenu>
{user.id ? (
{user.id && (
<AccodianMenu name={'기여한 문서'}>
<S.ContributeWrap>
<span>이 유저가 기여한 문서의 정보들이다.</span>
Expand All @@ -56,8 +56,6 @@ const MyPageLayout = ({ user, mutate }: MyPageLayoutPropsType) => {
</S.ContributeList>
</S.ContributeWrap>
</AccodianMenu>
) : (
''
)}
</S.MyPageInfoWrap>
</Board>
Expand Down
3 changes: 2 additions & 1 deletion pages/mypage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { QueryClient, useMutation } from 'react-query'
import { Storage } from '@/lib/storage/'
import { NextSeo, NextSeoProps } from 'next-seo'
import MyPageLayout from '@/layout/MyPageLayout'
import { initUserState } from '@/context/userState'

const MyPage = () => {
const { user, logout } = useUser()
Expand Down Expand Up @@ -47,7 +48,7 @@ const MyPage = () => {
return (
<>
<NextSeo {...seoConfig} />
<MyPageLayout user={user} mutate={mutate} />
<MyPageLayout user={user || initUserState} mutate={mutate} />
</>
)
}
Expand Down

0 comments on commit 367a5fd

Please sign in to comment.