import { EventHandlerRequest, H3Event } from "h3";

export default function (ev: H3Event<EventHandlerRequest>) {
	const id = parseInt(getRouterParam(ev, "id")!);
	if (Number.isNaN(id)) {
		throw createError({
			statusCode: 400,
			message: "Invalid id provided.",
		});
	}
	return id;
}
