getCurrentUserId
Returns the current Nextcloud user ID by reading window.OC.currentUser.
Signature
import { getCurrentUserId } from '@conduction/nextcloud-vue'
const uid = getCurrentUserId() // 'admin' | null
Returns
string | null:
window.OC.currentUser.uidif present,- else
window.OC.currentUser(older Nextcloud versions set this directly to a string), - else
null(not logged in, or running outside a Nextcloud page — e.g. unit tests).
Related
- getCurrentUserGroups — Async fetch of the user's groups.
- isWidgetVisible — Primary consumer.