Users with BO_DASHBOARD get period presets, capture and win tiles, the status funnel, a captures/wins trend and breakdowns by event, salesperson and interest; everyone else keeps the welcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
14 lines
674 B
TypeScript
14 lines
674 B
TypeScript
import { NextResponse, type NextRequest } from "next/server";
|
|
import { callMobileApi } from "@/app/lib/server/mobileApi";
|
|
import { getToken } from "@/app/lib/server/session";
|
|
import { errorResponse, unauthorized } from "@/app/lib/server/apiRoute";
|
|
|
|
// Proxy for /api/admin/dashboard/leads; mobile-api owns period validation and the BO_DASHBOARD guard.
|
|
export async function GET(req: NextRequest) {
|
|
const token = await getToken();
|
|
if (!token) return unauthorized();
|
|
const result = await callMobileApi<unknown>(`/api/admin/dashboard/leads${new URL(req.url).search}`, { token });
|
|
if (!result.ok) return errorResponse(result);
|
|
return NextResponse.json(result.data);
|
|
}
|