diff --git a/src/components/helper/RequireAuth.tsx b/src/components/helper/RequireAuth.tsx index 8fc604ab..6d1f050b 100644 --- a/src/components/helper/RequireAuth.tsx +++ b/src/components/helper/RequireAuth.tsx @@ -15,7 +15,7 @@ interface RequireAuthProps { } const RequireAuth = ({ children }: RequireAuthProps) => { - const { setUser, setIsLoadingUser } = useAuth(); + const { user, setUser, setIsLoadingUser } = useAuth(); const { data: userResponse, @@ -78,7 +78,7 @@ const RequireAuth = ({ children }: RequireAuthProps) => { ); } - return <>{isResponseSuccess(userResponse) && children}; + return <>{isResponseSuccess(userResponse) && user && children}; }; export default RequireAuth;