Updated Nav bar avatar to use hooks
This commit is contained in:
3
src/lib/hooks/index.ts
Normal file
3
src/lib/hooks/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './useAvatar';
|
||||
export * from './useFileUpload';
|
||||
export * from './useProfile';
|
@ -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);
|
||||
|
Reference in New Issue
Block a user