Skip to main content

Function: useAuthor()

useAuthor(did, options): UseQueryResult<OutputSchema, Error>

Defined in: web/lib/hooks/use-author.ts:135

Fetches an author profile by DID.

Parameters

did

string

The author's DID

options

UseAuthorOptions = {}

Query options

Returns

UseQueryResult<OutputSchema, Error>

Query result with author profile and metrics

Remarks

Uses TanStack Query with a 5-minute stale time. Returns both profile information and metrics in a single request.

Example

const { data, isLoading, error } = useAuthor('did:plc:abc123');

if (data) {
console.log(data.profile.displayName);
console.log(data.metrics.totalEprints);
}

Throws

When the API request fails or author is not found