Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
16 lines
766 B
TypeScript
16 lines
766 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";
|
|
|
|
type Ctx = { params: Promise<{ code: string }> };
|
|
|
|
// add-event-tickets: the staff view of a scanned ticket. mobile-api checks BO_EVENTS and the event's company.
|
|
export async function GET(_req: NextRequest, { params }: Ctx) {
|
|
const token = await getToken();
|
|
if (!token) return unauthorized();
|
|
const result = await callMobileApi<unknown>(`/api/admin/tickets/${encodeURIComponent((await params).code)}`, { token });
|
|
if (!result.ok) return errorResponse(result);
|
|
return NextResponse.json(result.data ?? {});
|
|
}
|