Spaces:
Running
Running
Update app/api/me/projects/[namespace]/[repoId]/route.ts
Browse files
app/api/me/projects/[namespace]/[repoId]/route.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { NextRequest, NextResponse } from "next/server";
|
|
| 2 |
import { isAuthenticated } from "@/lib/auth";
|
| 3 |
import Project from "@/models/Project";
|
| 4 |
import dbConnect from "@/lib/mongodb";
|
| 5 |
-
import { Page } from "@/types";
|
| 6 |
|
| 7 |
export async function GET(
|
| 8 |
req: NextRequest,
|
|
@@ -49,9 +48,10 @@ export async function GET(
|
|
| 49 |
},
|
| 50 |
{ status: 200 }
|
| 51 |
);
|
| 52 |
-
} catch (error:
|
|
|
|
| 53 |
return NextResponse.json(
|
| 54 |
-
{ error:
|
| 55 |
{ status: 500 }
|
| 56 |
);
|
| 57 |
}
|
|
|
|
| 2 |
import { isAuthenticated } from "@/lib/auth";
|
| 3 |
import Project from "@/models/Project";
|
| 4 |
import dbConnect from "@/lib/mongodb";
|
|
|
|
| 5 |
|
| 6 |
export async function GET(
|
| 7 |
req: NextRequest,
|
|
|
|
| 48 |
},
|
| 49 |
{ status: 200 }
|
| 50 |
);
|
| 51 |
+
} catch (error: unknown) {
|
| 52 |
+
const errorMessage = error instanceof Error ? error.message : 'An unknown error occurred';
|
| 53 |
return NextResponse.json(
|
| 54 |
+
{ error: errorMessage, ok: false },
|
| 55 |
{ status: 500 }
|
| 56 |
);
|
| 57 |
}
|