From f939f4b0fbb6a0f98b28dea967ba8aad19157eda Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Wed, 10 Dec 2025 18:10:08 +0700 Subject: [PATCH] fix: return children only if userResponse success and user is set --- src/components/helper/RequireAuth.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;