Database
This commit is contained in:
18
app/api/auth/session/route.ts
Normal file
18
app/api/auth/session/route.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { getSession } from '@/lib/auth';
|
||||
|
||||
export async function GET() {
|
||||
const session = await getSession();
|
||||
|
||||
if (!session) {
|
||||
return NextResponse.json({ authenticated: false }, { status: 401 });
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
authenticated: true,
|
||||
user: {
|
||||
id: session.userId,
|
||||
username: session.username,
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user