Skip to content

Commit

Permalink
feat: 렌더링 요소 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrin-byte committed Nov 29, 2024
1 parent 572bc08 commit acf5ffc
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/components/RequireAuth/RequireAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ import {
import { useSelectedThemeReset } from "@/components/atoms/selectedTheme.atom";
import { useIsLoggedIn } from "@/components/atoms/account.atom";
import { getSelectedThemeId } from "@/utils/localStorage";
import Header from "@/components/common/Header/Header";
import MainDrawer from "@/components/common/Drawer/Drawer";

import Mobile from "../Mobile/Mobile";

interface RequireAuthProps {
children: ReactNode;
}
function RequireAuth({
children,
}: RequireAuthProps){
function RequireAuth({ children }: RequireAuthProps) {
const [isLoggedIn, setIsLoggedIn] = useIsLoggedIn();
const [currentTheme, setCurrentTheme] = useCurrentTheme();
const resetCurrentTheme = useCurrentThemeReset();
Expand Down Expand Up @@ -72,8 +68,7 @@ function RequireAuth({

if (isMobile && !allowUnauthPaths.includes(pathname)) return <Mobile />;

if (!isLoggedIn) return <>{children}</>;
if (isLoggedIn && (pathname === "/" || "/admin")) return <>{children}</>;
return <>{children}</>;
}

export default RequireAuth;

0 comments on commit acf5ffc

Please sign in to comment.