import { getPendingSubmissions } from "../../../db/domains";

export default defineEventHandler(async (event) => {
  const config = useRuntimeConfig();
  const adminSecret = getHeader(event, "x-admin-secret");
  if (adminSecret !== config.adminSecret) {
    throw createError({ statusCode: 401, message: "Unauthorized" });
  }
  return getPendingSubmissions();
});
