Skip to content

Commit

Permalink
feat: redirect to personal dashboard when no last project
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Oct 1, 2024
1 parent 60206f8 commit 64c1024
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/component/InitialRedirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import useProjects from '../hooks/api/getters/useProjects/useProjects';
import { useLastViewedProject } from '../hooks/useLastViewedProject';
import Loader from './common/Loader/Loader';
import { getSessionStorageItem, setSessionStorageItem } from '../utils/storage';
import { useUiFlag } from '../hooks/useUiFlag';

export const InitialRedirect = () => {
const personalDashboardUiEnabled = useUiFlag('personalDashboardUI');
const { lastViewed } = useLastViewedProject();
const { projects, loading } = useProjects();
const navigate = useNavigate();
Expand All @@ -17,6 +19,10 @@ export const InitialRedirect = () => {
return `/projects/${lastViewed}`;
}

if (personalDashboardUiEnabled) {
return '/personal';
}

if (projects && !lastViewed && projects.length === 1) {
return `/projects/${projects[0].id}`;
}
Expand Down

0 comments on commit 64c1024

Please sign in to comment.