All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 50s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 14s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 0s
- เข้า /docedit เดิมใช้ redirects() (Next เติม basePath ให้ source /) ถอดออกให้ app/page.tsx ที่ root จับ /docedit และ /docedit/ แทน พร้อมส่งต่อ query เอง เพราะ redirect() ของ next/navigation ไม่แนบ searchParams ให้อัตโนมัติ (รักษาสัญญาลิงก์ e-Court /docedit/?fileUrl=&fileId=&typeId= ของ N8) - เพิ่ม skipTrailingSlashRedirect: true ปิด 308 trailing slash อัตโนมัติของ Next กัน ping-pong กับ rewrite rule ของ IIS ตอน deploy หลัง proxy - redirects() ใหม่แบบ basePath:false จับเฉพาะ root ของ host (/ แท้) ส่งตรงไป /docedit/note Co-Authored-By: Claude Code <noreply@anthropic.com>
23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
|
|
// หน้า root (/docedit) — แทน redirects() เดิมใน next.config.mjs (ถอดออกลด hop
|
|
// ที่ Next สั่งเองตอน deploy หลัง IIS/proxy): พาเข้าหน้ารายการของ /note เสมอ
|
|
// — redirect() ไม่แนบ searchParams ให้อัตโนมัติเหมือน redirects() จึงต้องส่งต่อ
|
|
// เอง ไม่งั้นสัญญาลิงก์ e-Court /docedit/?fileUrl=&fileId=&typeId= (N8) พัง
|
|
// (redirect ของ next/navigation เติม basePath ให้เอง — invariant #12)
|
|
export default function RootPage({
|
|
searchParams,
|
|
}: {
|
|
searchParams: Record<string, string | string[] | undefined>;
|
|
}) {
|
|
const qs = new URLSearchParams();
|
|
for (const [key, value] of Object.entries(searchParams)) {
|
|
if (typeof value === "string") {
|
|
qs.set(key, value);
|
|
} else if (Array.isArray(value)) {
|
|
for (const v of value) qs.append(key, v);
|
|
}
|
|
}
|
|
const query = qs.toString();
|
|
redirect(`/note${query ? `?${query}` : ""}`);
|
|
}
|