Skip to main content

useContractorDocumentsList

useContractorDocumentsList(params: UseContractorDocumentsListParams): UseContractorDocumentsListResult

Standalone data hook for a contractor's documents.

Remarks

Wraps the contractorDocumentsGetAll query in the standard BaseHookReady shape. Read-only — viewing or signing a document is handled by the screen the parent routes to, so this hook exposes no actions.

Example

Example
import { useContractorDocumentsList } from '@gusto/embedded-react-sdk'

function ContractorDocuments({ contractorId }: { contractorId: string }) {
const result = useContractorDocumentsList({ contractorId })

if (result.isLoading) return <div>Loading...</div>

return (
<ul>
{result.data.documents.map(doc => (
<li key={doc.uuid}>{doc.title}</li>
))}
</ul>
)
}

Props

UseContractorDocumentsListParams

Parameters for useContractorDocumentsList.

PropertyTypeDescription
contractorIdstringThe associated contractor identifier.

Returns

UseContractorDocumentsListResult

A HookLoadingResult while loading, or the ready state with data.documents once loaded.

UseContractorDocumentsListResult

UseContractorDocumentsListResult = HookLoadingResult | UseContractorDocumentsListReady

Result of useContractorDocumentsList — a discriminated union of loading and ready states.


UseContractorDocumentsListReady

Ready-state shape returned by useContractorDocumentsList once the documents have loaded.

PropertyTypeDescription
dataobjectHook-specific data payload; shape is narrowed by each concrete hook via TData.
data.documentsDocument[]-
errorHandlingHookErrorHandlingError state and recovery actions.
isLoadingfalseAlways false in this branch; discriminates from HookLoadingResult.
statusobjectHook-specific status flags; shape is narrowed by each concrete hook via TStatus.
status.isFetchingboolean-

Endpoints