export async function POST(request: NextRequest) {
try {
// Check authentication
const session = await auth.api.getSession({ headers: await headers() });
console.log(session) // this outputs `null`
if (!session) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
// do something here if the user is authenticated
} catch (error) {
console.error("Error categorizing link:", error);
return NextResponse.json(
{ error: "Failed to categorize link" },
{ status: 500 }
);
}
export async function POST(request: NextRequest) {
try {
// Check authentication
const session = await auth.api.getSession({ headers: await headers() });
console.log(session) // this outputs `null`
if (!session) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
// do something here if the user is authenticated
} catch (error) {
console.error("Error categorizing link:", error);
return NextResponse.json(
{ error: "Failed to categorize link" },
{ status: 500 }
);
}