Skip to content

Commit

Permalink
feat: navigate to projects sections if user is already logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
Prajwalism committed Jul 4, 2024
1 parent 1b7d926 commit 407d86c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/frontend/src/components/LandingPage/SignInOverlay/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useTypedDispatch } from '@Store/hooks';
import useAuth from '@Hooks/useAuth';
import { useNavigate } from 'react-router-dom';
import { FlexColumn, FlexRow } from '@Components/common/Layouts';
import { Button } from '@Components/RadixComponents/Button';
Expand All @@ -14,6 +15,7 @@ import { slideVariants } from '@Constants/animations';
export default function SignInOverlay() {
const dispatch = useTypedDispatch();
const navigate = useNavigate();
const { isAuthenticated } = useAuth();

return (
<motion.section
Expand Down Expand Up @@ -45,7 +47,11 @@ export default function SignInOverlay() {
rightIcon="east"
onClick={() => {
dispatch(setCommonState({ signInAs: 'Project Creator' }));
navigate('/login');
if (isAuthenticated()) {
navigate('/projects');
} else {
navigate('/login');
}
}}
>
I&apos;m a Project Creator
Expand All @@ -62,7 +68,11 @@ export default function SignInOverlay() {
rightIcon="east"
onClick={() => {
dispatch(setCommonState({ signInAs: 'Drone Operator' }));
navigate('/login');
if (isAuthenticated()) {
navigate('/projects');
} else {
navigate('/login');
}
}}
>
I&apos;m a Drone Operator
Expand Down

0 comments on commit 407d86c

Please sign in to comment.