Function: useAuthor()
useAuthor(
did,options):UseQueryResult<{metrics: {hIndex:number;totalDownloads:number;totalEndorsements:number;totalPreprints:number;totalReviews:number;totalViews:number; };profile: {affiliation:string;affiliations:object[];arxivAuthorId:string;avatar:string;bio:string;dblpId:string;did:string;displayName:string;fields:string[];googleScholarId:string;handle:string;nameVariants:string[];openAlexId:string;openReviewId:string;orcid:string;pdsEndpoint:string;previousAffiliations:object[];researchKeywords:object[];scopusAuthorId:string;semanticScholarId:string;website:string; }; },Error>
Defined in: web/lib/hooks/use-author.ts:83
Fetches an author profile by DID.
Parameters
did
string
The author's DID
options
UseAuthorOptions = {}
Query options
Returns
UseQueryResult<{ metrics: { hIndex: number; totalDownloads: number; totalEndorsements: number; totalPreprints: number; totalReviews: number; totalViews: number; }; profile: { affiliation: string; affiliations: object[]; arxivAuthorId: string; avatar: string; bio: string; dblpId: string; did: string; displayName: string; fields: string[]; googleScholarId: string; handle: string; nameVariants: string[]; openAlexId: string; openReviewId: string; orcid: string; pdsEndpoint: string; previousAffiliations: object[]; researchKeywords: object[]; scopusAuthorId: string; semanticScholarId: string; website: string; }; }, 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.totalPreprints);
}
Throws
When the API request fails or author is not found