From 0a3782946e02a581b901a36dc214b5f0b31d6d18 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sun, 30 Jul 2023 11:43:39 +0100 Subject: [PATCH] feat: add auth middleware and logout button --- components/pages/home/LoginButton.tsx | 17 ++++++++++------- middleware.js | 3 +++ 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 middleware.js diff --git a/components/pages/home/LoginButton.tsx b/components/pages/home/LoginButton.tsx index 91bd44b..10b2982 100644 --- a/components/pages/home/LoginButton.tsx +++ b/components/pages/home/LoginButton.tsx @@ -1,20 +1,23 @@ "use client"; import { Button } from "@/components/ui/button"; -import { useSession } from "next-auth/react"; +import { signIn, signOut, useSession } from "next-auth/react"; import Link from "next/link"; export function LoginButton() { const { data: session } = useSession(); - if (session || true) { + if (session) { return ( <> - + + @@ -23,9 +26,9 @@ export function LoginButton() { return ( <> - - - +