forked from admin/zeropost-tool
feat: admin dashboard UI — DashboardSection as default panel
AdminPanel: Сводка раздел первый (initialSection='dashboard') DashboardSection: users stats, channels by platform, posts stats, revenue vs AI costs cards, drafts pending alert, registrations bar chart 14d SECTIONS: +Dashboard, +Engine (Движок) API route: /api/admin/dashboard proxy
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { requireUser } from '@/lib/session';
|
||||
|
||||
const ENGINE_URL = process.env.ENGINE_URL || 'http://127.0.0.1:3030';
|
||||
const ENGINE_SECRET = process.env.ENGINE_SECRET || '';
|
||||
|
||||
export async function GET() {
|
||||
const user = await requireUser();
|
||||
if (!user?.isAdmin) return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
|
||||
const res = await fetch(`${ENGINE_URL}/api/admin/dashboard`, {
|
||||
headers: { 'x-internal-secret': ENGINE_SECRET, 'x-user-id': String(user.id) },
|
||||
cache: 'no-store',
|
||||
});
|
||||
return NextResponse.json(await res.json());
|
||||
}
|
||||
Reference in New Issue
Block a user