mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
Sorted all imports in all packages, `cms`, `design-system` and `ui-library` apps by running `pnpm format` on them. All changes in this PR are done by the script.
22 lines
542 B
TypeScript
22 lines
542 B
TypeScript
import { useEffect, useState } from 'react'
|
|
|
|
import { createClient } from '@/registry/default/clients/nextjs/lib/supabase/client'
|
|
|
|
export const useCurrentUserImage = () => {
|
|
const [image, setImage] = useState<string | null>(null)
|
|
|
|
useEffect(() => {
|
|
const fetchUserImage = async () => {
|
|
const { data, error } = await createClient().auth.getSession()
|
|
if (error) {
|
|
console.error(error)
|
|
}
|
|
|
|
setImage(data.session?.user.user_metadata.avatar_url ?? null)
|
|
}
|
|
fetchUserImage()
|
|
}, [])
|
|
|
|
return image
|
|
}
|