All files / app/auth/error page.tsx

0% Statements 0/14
0% Branches 0/4
0% Functions 0/3
0% Lines 0/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78                                                                                                                                                           
"use client";
 
import { useSearchParams } from "next/navigation";
import { Box, Button, Container, Paper, Typography } from "@mui/material";
import Link from "next/link";
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
import { Suspense } from "react";
 
function ErrorContent() {
  const searchParams = useSearchParams();
  const error = searchParams.get("error");
 
  const getErrorMessage = (error: string | null) => {
    switch (error) {
      case "Configuration":
        return "サーバーの設定に問題があります。管理者に連絡してください。";
      case "AccessDenied":
        return "アクセスが拒否されました。";
      case "Verification":
        return "認証トークンの有効期限が切れているか、既に使用されています。";
      default:
        return "認証中に予期しないエラーが発生しました。";
    }
  };
 
  return (
    <Container maxWidth="sm">
      <Box
        sx={{
          minHeight: "100vh",
          display: "flex",
          alignItems: "center",
          justifyContent: "center",
        }}
      >
        <Paper
          elevation={3}
          sx={{
            p: 4,
            width: "100%",
            textAlign: "center",
          }}
        >
          <ErrorOutlineIcon sx={{ fontSize: 64, color: "error.main", mb: 2 }} />
          <Typography variant="h5" component="h1" gutterBottom>
            認証エラー
          </Typography>
          <Typography variant="body1" color="text.secondary" sx={{ mb: 3 }}>
            {getErrorMessage(error)}
          </Typography>
          <Button
            component={Link}
            href="/auth/signin"
            variant="contained"
            size="large"
          >
            サインインページに戻る
          </Button>
        </Paper>
      </Box>
    </Container>
  );
}
 
export default function AuthErrorPage() {
  return (
    <Suspense fallback={
      <Container maxWidth="sm">
        <Box sx={{ minHeight: "100vh", display: "flex", alignItems: "center", justifyContent: "center" }}>
          Loading...
        </Box>
      </Container>
    }>
      <ErrorContent />
    </Suspense>
  );
}