Updated Nav bar avatar to use hooks

This commit is contained in:
2025-05-20 16:11:41 -05:00
parent 408bb140ba
commit 259aa46ef8
6 changed files with 49 additions and 48 deletions

3
src/lib/hooks/index.ts Normal file
View File

@ -0,0 +1,3 @@
export * from './useAvatar';
export * from './useFileUpload';
export * from './useProfile';

View File

@ -3,7 +3,7 @@ import { getProfile, updateProfile } from '@/lib/actions';
import type { Profile } from '@/utils/supabase';
import { toast } from 'sonner';
export function useProfile() {
export const useProfile = () => {
const [profile, setProfile] = useState<Profile | undefined>(undefined);
const [isLoading, setIsLoading] = useState(true);
@ -15,7 +15,7 @@ export function useProfile() {
if (!profileResponse.success)
throw new Error('Profile response unsuccessful');
setProfile(profileResponse.data);
} catch (error) {
} catch {
setProfile(undefined);
} finally {
setIsLoading(false);