refactor appeal for new and resume

This commit is contained in:
2026-01-15 13:21:11 +00:00
parent 9241fe0b84
commit 83dc4e12e3
11 changed files with 533 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
// lib/routing/requireQueryParams.js
// Simple query validator for getServerSideProps
export function requireQueryParams(query, requiredKeys = []) {
const missing = requiredKeys.filter((k) => !query?.[k]);
if (missing.length === 0) return { ok: true };
// Redirect to a generic error page you already have
// (you can swap this destination later)
const destination = `/error?missing=${encodeURIComponent(
missing.join(",")
)}`;
return {
ok: false,
redirect: {
destination,
permanent: false,
},
missing,
};
}