We finally fixed the sign in and sign out stuff with our client components not updating

This commit is contained in:
2025-05-30 11:19:22 -05:00
parent 28569c4f4e
commit 969e101d21
5 changed files with 89 additions and 64 deletions

View File

@ -13,14 +13,20 @@ import {
DropdownMenuTrigger,
} from '@/components/ui';
import { useAuth } from '@/components/context/auth';
import { useRouter } from 'next/navigation';
import { signOut } from '@/lib/actions';
import { User } from 'lucide-react';
const AvatarDropdown = () => {
const { profile, avatarUrl, isLoading } = useAuth();
const { profile, avatarUrl, isLoading, refreshUserData } = useAuth();
const router = useRouter();
const handleSignOut = async () => {
await signOut();
const result = await signOut();
if (result?.success) {
await refreshUserData();
router.push('/sign-in');
}
};
const getInitials = (name: string | null | undefined): string => {