diff --git a/app/(platform)/(dashboard)/workspace/[workspaceId]/page.tsx b/app/(platform)/(dashboard)/workspace/[workspaceId]/page.tsx
index fa3c0c6..aaac8c8 100644
--- a/app/(platform)/(dashboard)/workspace/[workspaceId]/page.tsx
+++ b/app/(platform)/(dashboard)/workspace/[workspaceId]/page.tsx
@@ -1,14 +1,20 @@
-'use client';
+"use client";
-import Header from '@/components/workspace-components/header';
-import ProjectCard from '@/components/project-components/project-card';
-import { getProjectsByWorkspaceId } from '@/db/mock.json';
-import { FetchWorkspaceProjectData } from '@/services/projectService';
-import { Skeleton } from '@/components/ui/skeleton';
+import Header from "@/components/workspace-components/header";
+import ProjectCard from "@/components/project-components/project-card";
+import { getProjectsByWorkspaceId } from "@/db/mock.json";
+import { FetchWorkspaceProjectData } from "@/services/projectService";
+import { Skeleton } from "@/components/ui/skeleton";
-import useProject from '@/hooks/useProject';
-import { formatDate } from '@/lib/utils';
-import { Ghost } from 'lucide-react';
+import useProject from "@/hooks/useProject";
+import { formatDate } from "@/lib/utils";
+import { Ghost } from "lucide-react";
+import { notFound, useRouter } from "next/navigation";
+import NotFound from "@/app/not-found";
+import { use, useEffect } from "react";
+import { AxiosError } from "axios";
+import { toast } from "sonner";
+import useWorkspaces from "@/hooks/useWorkspace";
type WorkspaceIdPageProps = {
params: { workspaceId: string };
@@ -16,6 +22,7 @@ type WorkspaceIdPageProps = {
const WorkspaceIdPage = ({ params }: WorkspaceIdPageProps) => {
const { FetchWorkspaceProjectsQuery } = useProject();
+
const projectsResponse = FetchWorkspaceProjectsQuery(params?.workspaceId);
const isFetching = projectsResponse.isFetching;
const workspaceId = params?.workspaceId;
@@ -26,13 +33,13 @@ const WorkspaceIdPage = ({ params }: WorkspaceIdPageProps) => {
<>
Add a project and get scheduling!😉
diff --git a/app/(platform)/(dashboard)/workspace/[workspaceId]/settings/page.tsx b/app/(platform)/(dashboard)/workspace/[workspaceId]/settings/page.tsx index ef917d6..18a3185 100644 --- a/app/(platform)/(dashboard)/workspace/[workspaceId]/settings/page.tsx +++ b/app/(platform)/(dashboard)/workspace/[workspaceId]/settings/page.tsx @@ -61,15 +61,7 @@ const router = useRouter(); const handleDeleteWorkspace = async () => { try { await deleteWorkspaceMutation.mutateAsync({ workspaceId }); - // Redirect after successful deletion - if (isSuccessWorkspace && workspaces && workspaces.length > 0) { - router.push(`/workspace/${workspaces[0].id}`); - } else { - // Redirect to create-workspace route only if workspaces query has successfully fetched data - if (!workspaces) { - router.replace('/create-workspace'); // Use router.replace instead of router.push - } - } + } catch (error) { console.error("Error deleting workspace:", error); } diff --git a/app/not-found.tsx b/app/not-found.tsx index 669754e..3dea08f 100644 --- a/app/not-found.tsx +++ b/app/not-found.tsx @@ -1,26 +1,28 @@ -'use client'; +"use client"; -import { Button } from '@/components/ui/button'; -import Image from 'next/image'; -import { useRouter } from 'next/navigation'; +import { Button } from "@/components/ui/button"; +import Image from "next/image"; +import { useRouter } from "next/navigation"; const NotFound = () => { const router = useRouter(); return ( -+
Sorry we couldn't find this page.
-+
But dont worry, you can find plenty of other things on our homepage.
- +