Create not-found.tsx and global-error.tsx to prevent Next.js from falling back to legacy Pages Router _error pages during static generation, which fail with useContext null in Docker. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42 lines
892 B
TypeScript
42 lines
892 B
TypeScript
"use client";
|
|
|
|
export default function GlobalError({
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
return (
|
|
<html lang="en">
|
|
<body
|
|
style={{
|
|
backgroundColor: "#252A2F",
|
|
display: "flex",
|
|
flexDirection: "column",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
minHeight: "100vh",
|
|
gap: 16,
|
|
fontFamily: "Lato, sans-serif",
|
|
color: "white",
|
|
}}
|
|
>
|
|
<h2>Terjadi Kesalahan</h2>
|
|
<button
|
|
onClick={() => reset()}
|
|
style={{
|
|
padding: "8px 16px",
|
|
borderRadius: 4,
|
|
border: "1px solid #ccc",
|
|
background: "transparent",
|
|
color: "white",
|
|
cursor: "pointer",
|
|
}}
|
|
>
|
|
Coba Lagi
|
|
</button>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|