🐛 404 페이지 라우팅 조건 수정
This commit is contained in:
@@ -95,7 +95,7 @@ const App = ({ component: Component, ...pageProps }: AppProps) => {
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (mounted && flatMenus) {
|
||||
if (mounted && data?.length > 0 && flatMenus?.length > 0) {
|
||||
let path =
|
||||
router.asPath.indexOf('?') === -1
|
||||
? router.asPath
|
||||
@@ -110,7 +110,7 @@ const App = ({ component: Component, ...pageProps }: AppProps) => {
|
||||
}
|
||||
|
||||
// 권한 없는 페이지 대해 호출이 있으면 404로 redirect
|
||||
if (!authPage && flatMenus.length > 0 && !current) {
|
||||
if (!authPage && !current) {
|
||||
if (!PUBLIC_PAGES.includes(router.asPath)) {
|
||||
router.push('/404')
|
||||
}
|
||||
@@ -118,7 +118,7 @@ const App = ({ component: Component, ...pageProps }: AppProps) => {
|
||||
|
||||
setCurrentMenus(current)
|
||||
}
|
||||
}, [router, mounted, flatMenus])
|
||||
}, [router, mounted, flatMenus, data])
|
||||
|
||||
if (loading) {
|
||||
return <Loader />
|
||||
@@ -128,6 +128,10 @@ const App = ({ component: Component, ...pageProps }: AppProps) => {
|
||||
return null
|
||||
}
|
||||
|
||||
if (data?.length <= 0 || flatMenus?.length <= 0) {
|
||||
return <Loader />
|
||||
}
|
||||
|
||||
return errorPage || naverLoginCallbackPage ? (
|
||||
<Wrapper>
|
||||
<Component {...pageProps} />
|
||||
|
||||
Reference in New Issue
Block a user