Skip to content

Commit

Permalink
redirect to onboarding if no workspaces yet (#118)
Browse files Browse the repository at this point in the history
* redirect to onboarding if no workspaces yet

* router replace, and check for isLoading
  • Loading branch information
dinmukhamedm authored Nov 1, 2024
1 parent b754663 commit 4ffe03d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/components/projects/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import WorkspaceCreateDialog from './workspace-create-dialog';
import useSWR from 'swr';
import { swrFetcher } from '@/lib/utils';
import { Skeleton } from '../ui/skeleton';
import { useRouter } from 'next/navigation';

interface ProjectsProps {
isWorkspaceEnabled: boolean;
Expand All @@ -20,6 +21,11 @@ export default function Projects({ isWorkspaceEnabled }: ProjectsProps) {
swrFetcher
);

const router = useRouter();
if (!isLoading && data !== undefined && data.length === 0) {
router.replace('/onboarding');
}

return (
<>
<div className="h-full p-4 w-full flex-grow">
Expand Down

0 comments on commit 4ffe03d

Please sign in to comment.