implement auth error page and moved auth-related pages to /auth path
This commit is contained in:
49
src/app/auth/signout/page.tsx
Normal file
49
src/app/auth/signout/page.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import { signOut, auth } from "@/auth"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { redirect } from "next/navigation"
|
||||
import Link from "next/link"
|
||||
|
||||
export default async function SignOutPage() {
|
||||
const session = await auth()
|
||||
|
||||
if (!session) {
|
||||
redirect("/")
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-background p-4">
|
||||
<Card className="w-full max-w-md">
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-2xl font-bold">Sign Out</CardTitle>
|
||||
<CardDescription>
|
||||
Are you sure you want to sign out?
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="text-center p-3 bg-muted rounded-lg">
|
||||
<div className="text-sm text-muted-foreground">Currently signed in as</div>
|
||||
<div className="font-medium">{session.user?.name || session.user?.email}</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<form
|
||||
action={async () => {
|
||||
"use server"
|
||||
await signOut({ redirectTo: "/" })
|
||||
}}
|
||||
>
|
||||
<Button type="submit" variant="destructive" className="w-full">
|
||||
Sign Out
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/">Cancel</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user