useWorkspace
List, create, and select workspaces for the current user.
import { useWorkspace } from 'flowstack-sdk'Signature
const { workspaces, selectedWorkspace, isLoading, error, createWorkspace, selectWorkspace, refreshWorkspaces } = useWorkspace()Returns
| Field | Type | Description |
|---|---|---|
workspaces | WorkspaceInfo[] | Available workspaces. |
selectedWorkspace | WorkspaceInfo | null | The currently selected workspace. |
isLoading | boolean | Request in flight. |
error | string | null | Last error message. |
createWorkspace | (name, description?) => Promise<WorkspaceInfo | null> | Create a new workspace. |
selectWorkspace | (workspace) => void | Set the active workspace. |
refreshWorkspaces | () => Promise<void> | Re-fetch the workspace list. |
Examples
Workspace management
const {
workspaces, // WorkspaceInfo[]
selectedWorkspace, // WorkspaceInfo | null
isLoading, // boolean
error, // string | null
createWorkspace, // (name, description?) => Promise<WorkspaceInfo | null>
selectWorkspace, // (workspace) => void
refreshWorkspaces, // () => Promise<void>
} = useWorkspace();See also
Source: README.md#useworkspace · Also available in llms-full.txt and registry.json.