React Hooks

Client-side utilities to interact with the active tenant context and current session.

useTenant()

Retrieve the currently active tenant object. Throws an error if used outside a multi-tenant route.

'use client'
import { useTenant } from '@odyssey/react'

export function DashboardHeader() {
  const { tenant, isLoading } = useTenant()
  
  if (isLoading) return <Loading />
  
  return <h1>Workspace: {tenant.name}</h1>
}

useWorkspaceMembers()

Fetch and manage members within the current tenant context.

const { members, inviteMember, removeMember } = useWorkspaceMembers()

// Invite user
await inviteMember({ email: 'new@example.com', role: 'admin' })