|
- "use client";
-
- import { useEffect } from "react";
-
- /**
- * Catches root-level errors (e.g. backend down during deploy).
- * Redirects to login instead of showing the default "Application error" page.
- * Must define <html> and <body> because this replaces the root layout.
- */
- export default function GlobalError({
- error,
- reset,
- }: {
- error: Error & { digest?: string };
- reset: () => void;
- }) {
- useEffect(() => {
- window.location.href = "/login";
- }, []);
-
- return (
- <html lang="zh-TW">
- <body>
- <div
- style={{
- display: "flex",
- minHeight: "100vh",
- alignItems: "center",
- justifyContent: "center",
- fontFamily: "system-ui, sans-serif",
- padding: "1rem",
- }}
- >
- <p style={{ color: "#64748b", fontSize: "0.875rem" }}>
- 連線異常,正在導向登入頁…
- </p>
- </div>
- </body>
- </html>
- );
- }
|