Function: useCreateEndorsement()
useCreateEndorsement():
UseMutationResult<{comment:string;contributions: ("data"|"methodological"|"analytical"|"theoretical"|"empirical"|"conceptual"|"technical"|"replication"|"reproducibility"|"synthesis"|"interdisciplinary"|"pedagogical"|"visualization"|"societal-impact"|"clinical")[];createdAt:string;endorser: {avatar:string;did:string;displayName:string;handle:string; };preprintUri:string;updatedAt:string;uri:string; },Error,CreateEndorsementInput,unknown>
Defined in: web/lib/hooks/use-endorsement.ts:341
Mutation hook for creating a new endorsement.
Returns
UseMutationResult<{ comment: string; contributions: ("data" | "methodological" | "analytical" | "theoretical" | "empirical" | "conceptual" | "technical" | "replication" | "reproducibility" | "synthesis" | "interdisciplinary" | "pedagogical" | "visualization" | "societal-impact" | "clinical")[]; createdAt: string; endorser: { avatar: string; did: string; displayName: string; handle: string; }; preprintUri: string; updatedAt: string; uri: string; }, Error, CreateEndorsementInput, unknown>
Mutation object for creating endorsements
Remarks
Creates an endorsement in the user's PDS. Users can only have one endorsement per preprint but can select multiple contribution types.
Automatically invalidates relevant queries on success.
Example
const createEndorsement = useCreateEndorsement();
const handleEndorse = async (contributions: ContributionType[]) => {
await createEndorsement.mutateAsync({
preprintUri,
contributions: ['methodological', 'empirical'],
comment: 'Excellent methodology and strong empirical evidence!',
});
};