Skip to content

Commit

Permalink
fix(user-profile): navigate to complete profile only after the profil…
Browse files Browse the repository at this point in the history
…e fetching is completed
  • Loading branch information
Sujit committed Oct 2, 2024
1 parent b33ed4d commit 7bd0bc4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/frontend/src/components/common/UserProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ export default function UserProfile() {
const [toggle, setToggle] = useState(false);
const navigate = useNavigate();

const { data: userDetails }: Record<string, any> = useGetUserDetailsQuery();
const { data: userDetails, isFetching }: Record<string, any> =
useGetUserDetailsQuery();
const userProfile = getLocalStorageValue('userprofile');

useEffect(() => {
if (userDetails?.has_user_profile) return;
if (userDetails?.has_user_profile || isFetching) return;
if (!userDetails?.has_user_profile) navigate('/complete-profile');
}, [userDetails?.has_user_profile, navigate]);
}, [userDetails?.has_user_profile, navigate, isFetching]);

const settingOptions = [
{
Expand Down

0 comments on commit 7bd0bc4

Please sign in to comment.