summaryrefslogtreecommitdiff
path: root/src/pages/logout.tsx
blob: 880d1758c02c5a3fd04868cbbe9b0fdeeb9ea12e (plain)
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
import { getContextData } from "waku/middleware/context";
import { useCookies } from "@/lib/server/cookiebridge";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import Navbar from "@/components/Navbar";

export default async function LogoutPage() {
  const { user } = getContextData() as any;
  const loggedIn = !!user;

  // If the user is logged in, delete the cookie
  if (loggedIn) {
    const { delCookie } = useCookies();
    delCookie("sorlang");
  }

  return (
    <div className="min-h-screen bg-gray-50">
      <Navbar user={null} />
      
      <div className="container mx-auto py-16 px-4">
        <Card className="max-w-md mx-auto p-6 text-center">
          <h1 className="text-2xl font-bold mb-4">
            {loggedIn ? "You've been logged out" : "Already logged out"}
          </h1>
          <p className="text-gray-600 mb-6">
            {loggedIn 
              ? "Your session has been ended successfully. Thank you for using Sorlang."
              : "You were not logged in."}
          </p>
          <div className="flex flex-col space-y-4">
            <Button asChild>
              <a href="/login">Log back in</a>
            </Button>
            <Button variant="outline" asChild>
              <a href="/">Return to home page</a>
            </Button>
          </div>
        </Card>
      </div>
    </div>
  );
}

export const getConfig = async () => {
  return {
    render: "dynamic",
  } as const;
};