ultisuite-client/lib/api/hooks/use-current-user.ts
R3D347HR4Y ad1370ea7e
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat: enhance configuration and add new demo layouts
- Introduced turbopack alias for canvas in next.config.mjs.
- Updated package.json scripts for development and branding tasks.
- Added new dependencies for Tiptap extensions.
- Implemented new demo layouts for agenda, contacts, drive, and mail applications.
- Enhanced globals.css for improved theming and splash screen animations.
- Added OAuth callback handling for drive mounts.
- Updated layout components to integrate new demo shells and improve structure.
2026-06-12 19:10:24 +02:00

34 lines
910 B
TypeScript

"use client"
import { useQuery } from "@tanstack/react-query"
import { apiClient } from "@/lib/api/client"
import type { AdminUserRole } from "@/lib/api/admin-types"
import type { AgendaOrgAgendaPublic } from "@/lib/agenda/agenda-settings-types"
import type { DriveOrgDrivePublic } from "@/lib/api/types"
import { useAuthReady } from "@/lib/api/use-auth-ready"
export type CurrentUser = {
sub: string
email: string
name: string
status: string
platform_admin: boolean
role: AdminUserRole
groups?: string[]
avatar_url?: string
org_agenda?: AgendaOrgAgendaPublic | null
org_drive?: DriveOrgDrivePublic | null
}
export function useCurrentUser() {
const { ready, authenticated } = useAuthReady()
return useQuery({
queryKey: ["current-user"],
queryFn: () => apiClient.get<CurrentUser>("/users/me"),
staleTime: 60_000,
enabled: ready && authenticated,
retry: 1,
})
}