Skip to content

User

Overview

useUser() provides reactive access to the currently authenticated user, read directly from the global KDK store (user path). All returned values update automatically when the user logs in, logs out, or their profile is patched.

Usage

javascript
import { useUser } from '@kalisio/kdk/core.client'

const { User, name, description, avatar, role } = useUser()

Exposed

NameTypeDescription
UserRef<Object | null>The raw user object from the global store, or null when no user is authenticated.
nameComputedRef<string>The display name, resolved in order from profile.name, profile.username, then email. Empty string if none is found.
descriptionComputedRef<string>The value of profile.description, or an empty string.
avatarComputedRef<Object>The full profile object, used as input to avatar components. Empty object when no user is authenticated.
roleComputedRef<string | undefined>The user's primary role. If permissions is a string it is returned directly; if it is an array the first element is returned. undefined when no permissions are set.