diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 3c252bb27..38fe4626a 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,8 +3,6 @@ import { Inter } from "next/font/google"; import "./globals.css"; -import { SessionProvider } from "next-auth/react"; - import Providers from "~/components/providers"; import { Toaster } from "~/components/ui/toaster"; @@ -24,7 +22,7 @@ export default function RootLayout({
- {children} + {children}
diff --git a/src/components/card/user-card.tsx b/src/components/card/user-card.tsx index 1d46b02c8..d75b65cc1 100644 --- a/src/components/card/user-card.tsx +++ b/src/components/card/user-card.tsx @@ -1,5 +1,4 @@ import { AnimatePresence, motion } from "framer-motion"; -import { signOut } from "next-auth/react"; import { useEffect, useState } from "react"; import { useUser } from "~/hooks/user/use-user"; @@ -13,7 +12,6 @@ const UserCard = ({ email }: { email: string }) => { const handleLogout = () => { updateUser({ email: "", name: "" }); setIsLogout(false); - signOut({ callbackUrl: "/" }); }; const handleEscapeClick = (event: KeyboardEvent) => { diff --git a/src/components/layouts/navbar/index.tsx b/src/components/layouts/navbar/index.tsx index a78994c54..91b9c3fdb 100644 --- a/src/components/layouts/navbar/index.tsx +++ b/src/components/layouts/navbar/index.tsx @@ -1,18 +1,18 @@ "use client"; -import { useSession } from "next-auth/react"; import Link from "next/link"; import { useEffect, useState } from "react"; import UserCard from "~/components/card/user-card"; import Logo from "~/components/common/logo"; +import { useUser } from "~/hooks/user/use-user"; import { cn } from "~/lib/utils"; import { NAV_LINKS } from "./links"; import MobileNav from "./mobile-navbar"; const Navbar = () => { const [scrolling, setIsScrolling] = useState(false); - const { data: session } = useSession(); + const { user } = useUser(); const handleScrollEvent = () => { if (window.scrollY > 1) { @@ -36,7 +36,7 @@ const Navbar = () => { className={cn( `relative mx-auto flex w-full max-w-[1200px] items-center gap-x-4 transition-all duration-500 md:justify-between`, scrolling ? "py-2" : "py-4 md:py-9", - session?.user?.email && "justify-between", + user.email && "justify-between", )} > @@ -55,9 +55,7 @@ const Navbar = () => { ); })} - {session?.user?.email ? ( - - ) : ( + {!user.email && (
{
)} + {user.email && } );