Skip to content

Commit 71465f4

Browse files
authored
Merge pull request #59 from diggerhq/feat/redirect-deleted-projects
Redirect deleted projects to dashboard
2 parents c792a06 + 4d87bc7 commit 71465f4

File tree

2 files changed

+6
-1
lines changed
  • src
    • app/(dynamic-pages)/(authenticated-pages)/(application-pages)/project/[projectSlug]/(specific-project-pages)
    • data/user

2 files changed

+6
-1
lines changed

src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/project/[projectSlug]/(specific-project-pages)/page.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getSlimProjectBySlug } from "@/data/user/projects";
22
import { projectSlugParamSchema } from "@/utils/zod-schemas/params";
33
import type { Metadata } from "next";
4+
import { redirect } from 'next/navigation';
45
import AllRunsDetails from "./AllRunsDetails";
56

67
type ProjectPageProps = {
@@ -25,6 +26,10 @@ export default async function ProjectPage({ params }: { params: unknown }) {
2526
const { projectSlug } = projectSlugParamSchema.parse(params);
2627
const slimProject = await getSlimProjectBySlug(projectSlug);
2728

29+
if (slimProject.deleted_at) {
30+
redirect("/dashboard");
31+
}
32+
2833
return (
2934
<div className="flex flex-col space-y-4 max-w-5xl mt-2">
3035
<AllRunsDetails projectId={slimProject.id} projectSlug={projectSlug} />

src/data/user/projects.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const getSlimProjectBySlug = async (projectSlug: string) => {
2929
const supabaseClient = createSupabaseUserServerComponentClient();
3030
const { data, error } = await supabaseClient
3131
.from("projects")
32-
.select("id, slug, name, organization_id, branch")
32+
.select("id, slug, name, organization_id, branch, deleted_at")
3333
.eq("slug", projectSlug)
3434
.single();
3535
if (error) {

0 commit comments

Comments
 (0)