FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 lines
961 B

  1. "use client";
  2. import { useEffect } from "react";
  3. /**
  4. * Catches root-level errors (e.g. backend down during deploy).
  5. * Redirects to login instead of showing the default "Application error" page.
  6. * Must define <html> and <body> because this replaces the root layout.
  7. */
  8. export default function GlobalError({
  9. error,
  10. reset,
  11. }: {
  12. error: Error & { digest?: string };
  13. reset: () => void;
  14. }) {
  15. useEffect(() => {
  16. window.location.href = "/login";
  17. }, []);
  18. return (
  19. <html lang="zh-TW">
  20. <body>
  21. <div
  22. style={{
  23. display: "flex",
  24. minHeight: "100vh",
  25. alignItems: "center",
  26. justifyContent: "center",
  27. fontFamily: "system-ui, sans-serif",
  28. padding: "1rem",
  29. }}
  30. >
  31. <p style={{ color: "#64748b", fontSize: "0.875rem" }}>
  32. 連線異常,正在導向登入頁…
  33. </p>
  34. </div>
  35. </body>
  36. </html>
  37. );
  38. }