diff --git a/app/auth/sign-in/page.tsx b/app/auth/sign-in/page.tsx index 88a68b22..a8b565ac 100644 --- a/app/auth/sign-in/page.tsx +++ b/app/auth/sign-in/page.tsx @@ -3,21 +3,24 @@ import { cookies } from "next/headers"; import { redirect } from "next/navigation"; import SignIn from "./sign-in"; -export default async function SignInPage( - props: { searchParams: Promise> } -) { - const sp = await props.searchParams; +export default async function SignInPage({ + searchParams, +}: { + searchParams?: Record; +}) { + const sp = searchParams ?? {}; const nextParam = Array.isArray(sp.next) ? sp.next[0] : sp.next; - const nextPath = nextParam && nextParam.startsWith("/") ? nextParam : "/portal"; + const nextPath = + nextParam && String(nextParam).startsWith("/") ? String(nextParam) : "/portal"; const reauthParam = Array.isArray(sp.reauth) ? sp.reauth[0] : sp.reauth; - const forceParam = Array.isArray(sp.force) ? sp.force[0] : sp.force; + const forceParam = Array.isArray(sp.force) ? sp.force[0] : sp.force; const reauth = reauthParam === "1" || forceParam === "1"; // If reauth is requested, always render the form (no redirect). if (!reauth) { - const at = (await cookies()).get("ma_at")?.value; + const at = cookies().get("ma_at")?.value; if (at) redirect("/portal"); } diff --git a/app/submit/settings/success/page.tsx b/app/submit/settings/success/page.tsx index 83f68c18..b8d1a900 100644 --- a/app/submit/settings/success/page.tsx +++ b/app/submit/settings/success/page.tsx @@ -20,16 +20,17 @@ const TARGET_LABEL: Record = { export default async function SuccessPage({ searchParams, }: { - // Next 15 types `searchParams` as a Promise - searchParams: Promise>; + searchParams?: Record; }) { - const sp = await searchParams; + const sp = searchParams ?? {}; const rawTarget = sp?.target; const rawId = sp?.id; const valid: Target[] = ["settings_fiber", "settings_co2gan", "settings_co2gal", "settings_uv"]; - const t: Target = (valid.includes(rawTarget as Target) ? (rawTarget as Target) : "settings_fiber"); + const t: Target = valid.includes(rawTarget as Target) + ? (rawTarget as Target) + : "settings_fiber"; const id = Array.isArray(rawId) ? rawId[0] : rawId || ""; const listHref = TARGET_TO_LIST[t]; @@ -38,20 +39,28 @@ export default async function SuccessPage({ return (
-
-

Settings submitted!

+
+

Submission received

Your {label} submission has been received. - {id ? <> Reference ID: {id}. : null} + {id ? ( + <> + {" "} + Reference ID: {id}. + + ) : null}

View {label} database - + Submit another diff --git a/tsconfig.json b/tsconfig.json index ab0c0f42..37c2173d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,6 @@ { "compilerOptions": { - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": false, @@ -13,22 +9,16 @@ "incremental": true, "esModuleInterop": true, "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "baseUrl": ".", "paths": { - "@/*": [ - "./*" - ] + "@/*": ["./*"] }, - "plugins": [ - { - "name": "next" - } - ], - "target": "ES2017" + "plugins": [{ "name": "next" }], + "target": "ES2022" }, "include": [ "next-env.d.ts", @@ -36,7 +26,5 @@ "**/*.ts", "**/*.tsx" ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file + "exclude": ["node_modules"] +}