mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 03:55:38 -04:00
Simplify auth, remove abstraction layers, add shadcn components
- Delete lib/api/errors.ts and lib/api/auth-guard.ts, inline NextResponse.json() error responses directly in route handlers - Replace non-standard amber CSS variables with primary/primary-foreground - Regenerate shadcn UI components with biome-ignore comments - Add CLAUDE.md for repository guidance - Update dependencies and pnpm lockfile Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import { headers } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
import { AuthError, requireAuth } from "@/lib/api/auth-guard";
|
||||
import { unauthorized } from "@/lib/api/errors";
|
||||
import { auth } from "@/lib/auth/server";
|
||||
import { getContinueWatchingFeed } from "@/lib/services/discovery";
|
||||
|
||||
export async function GET() {
|
||||
let userId: string;
|
||||
try {
|
||||
userId = await requireAuth();
|
||||
} catch (e) {
|
||||
if (e instanceof AuthError) return unauthorized();
|
||||
throw e;
|
||||
}
|
||||
const feed = getContinueWatchingFeed(userId);
|
||||
const session = await auth.api.getSession({
|
||||
headers: await headers(),
|
||||
});
|
||||
if (!session)
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
|
||||
const feed = getContinueWatchingFeed(session.user.id);
|
||||
return NextResponse.json(feed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user