Files
biblical-guide.com/app/api/admin/auth/me/route.ts
Andrei 4303e48fac Fix Next.js 15 compatibility and TypeScript errors
- Update API route handlers to use async params for Next.js 15 compatibility
- Fix MUI DataGrid deprecated props (pageSize -> initialState.pagination)
- Replace Material-UI Grid components with Box for better compatibility
- Fix admin authentication system with proper request parameters
- Update permission constants to match available AdminPermission enum values
- Add missing properties to Page interface for type safety
- Update .gitignore to exclude venv/, import logs, and large data directories
- Optimize Next.js config to reduce memory usage during builds

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 09:54:13 +00:00

43 lines
1.1 KiB
TypeScript

import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
import { getCurrentAdmin } from '@/lib/admin-auth';
export const runtime = 'nodejs';
export async function GET(request: Request) {
try {
console.log('Admin auth check - starting...');
const cookieStore = await cookies();
const token = cookieStore.get('adminToken')?.value;
console.log('Admin token found:', !!token);
if (!token) {
console.log('No admin token found in cookies');
return NextResponse.json(
{ error: 'Not authenticated - no token' },
{ status: 401 }
);
}
const admin = await getCurrentAdmin(request as any);
console.log('Admin user found:', !!admin);
if (!admin) {
console.log('Admin token invalid or user not found');
return NextResponse.json(
{ error: 'Not authenticated - invalid token' },
{ status: 401 }
);
}
return NextResponse.json({ user: admin });
} catch (error) {
console.error('Get admin user error:', error);
return NextResponse.json(
{ error: 'Server error' },
{ status: 500 }
);
}
}