back to square 1. Now convert the json format info into readable webpage info

This commit is contained in:
bobbert committed 2025-03-12 19:04:25 +00:00
1 parent b039af238f
commit 68e9af2d83
6 files changed
+112 -50

No files matched your search

+16 -10
View File
@@ -1,16 +1,22 @@
import { query, queryOne } from "@/lib/db";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../../auth/[...nextauth]/route";
export async function GET(_, context) {
// Changed 'request' to '_' to indicate unused parameter
const session = await getServerSession(authOptions);
if (!session) {
return Response.json({ error: "Unauthorized" }, { status: 401 });
}
import { cookies } from "next/headers";
import { verifyToken } from "@/app/api/auth/[...nextauth]/route";
export async function GET(request, context) {
try {
// Use our custom token verification
const cookieStore = await cookies();
const sessionToken = cookieStore.get("next-auth.session-token")?.value;
if (!sessionToken) {
return Response.json({ error: "Unauthorized" }, { status: 401 });
}
const userData = verifyToken(sessionToken);
if (!userData) {
return Response.json({ error: "Invalid session" }, { status: 401 });
}
const teamId = context.params.teamId;
// Validate teamId