fix(server/utils): add isIdNan helper function

This commit is contained in:
parent be32464c93
commit 9ba432a8e0
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -0,0 +1,12 @@
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;
}