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
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.
| Property | Type | Description |
|---|---|---|
contractorId | string | The 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.
| Property | Type | Description |
|---|---|---|
data | object | Hook-specific data payload; shape is narrowed by each concrete hook via TData. |
data.documents | Document[] | - |
errorHandling | HookErrorHandling | Error state and recovery actions. |
isLoading | false | Always false in this branch; discriminates from HookLoadingResult. |
status | object | Hook-specific status flags; shape is narrowed by each concrete hook via TStatus. |
status.isFetching | boolean | - |
Endpoints
| Method | Path |
|---|---|
| GET | /v1/contractors/:contractorUuid/documents |