import type {NextRequest} from 'next/server'; import {sitesApi} from '@/services/api/sitesApi'; import {proxyUpstream} from '@/shared/services/bff'; export const dynamic = 'force-dynamic'; /** POST /api/sites/{site}/enrolment-code - the code a new shop PC types. */ export async function POST(req: NextRequest, ctx: {params: Promise<{site: string}>}) { const {site} = await ctx.params; return proxyUpstream( req, (token, body) => sitesApi.enrolmentCode(token, site, { label: typeof body.label === 'string' ? body.label : undefined, ttl_hours: typeof body.ttl_hours === 'number' ? body.ttl_hours : undefined, }), {status: 201}, ); }