'use client' import { emitAuthChanged, useAuth } from 'hooks/useAuth' import { useRouter, usePathname } from 'next/navigation' import Link from 'next/link' export function Header() { const { user, loading } = useAuth() const router = useRouter() const pathname = usePathname() const handleLogout = async () => { await fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }) emitAuthChanged() router.push('/') } if (user) { // Logged in header return ( <>
Let'sChat
) } // Not logged in header return ( <>
Let'sChat
) }