mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-07-04 01:10:53 +00:00
refactor(auth): Relocate unauthorized page
This commit is contained in:
parent
700f1e2cbe
commit
8a6fedd928
41
src/app/(auth)/unauthorized/page.tsx
Normal file
41
src/app/(auth)/unauthorized/page.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ArrowLeftIcon, HomeIcon } from "lucide-react";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
export default function UnauthorizedPage() {
|
||||
const router = useRouter();
|
||||
|
||||
const handleGoBack = () => {
|
||||
router.back();
|
||||
};
|
||||
|
||||
const handleGoHome = () => {
|
||||
router.push("/");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-background">
|
||||
<Card className="w-full max-w-md text-center">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-red-500 text-6xl font-bold">403</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="mb-6 text-xl text-muted-foreground">你无权访问该页面</p>
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<Button onClick={handleGoBack} variant="secondary">
|
||||
<ArrowLeftIcon />
|
||||
<span>返回</span>
|
||||
</Button>
|
||||
<Button onClick={handleGoHome}>
|
||||
<HomeIcon />
|
||||
<span>首页</span>
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
|
||||
export default function ForbiddenPage() {
|
||||
const handleGoBack = () => {
|
||||
redirect("/")
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-screen bg-background">
|
||||
<Card className="w-full max-w-md text-center">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-6xl font-bold text-red-500">403</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-xl mb-6 text-muted-foreground">你无权访问该页面</p>
|
||||
<Button onClick={handleGoBack} variant="default">
|
||||
返回上一页
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user