Files
Flight-Ops/app/api/planes/[planeId]/refuel/route.ts
T

12 lines
585 B
TypeScript

import { performAction, refuelPlane } from '@/lib/game/actions';
// POST /api/planes/:planeId/refuel (v0.8.0) — no body. Fills a grounded plane to
// maxFuel at the fuel price per missing liter; deducts the cost from cash. 404
// unknown id; 409 if the plane is flying or cash is insufficient. On success
// returns the full state snapshot (fuel back to max, cash reduced by the cost).
export async function POST(_req: Request, ctx: { params: Promise<{ planeId: string }> }) {
const { planeId } = await ctx.params;
return performAction((inst) => refuelPlane(inst, planeId));
}