Skip to main content

Function: useUpdateEprint()

useUpdateEprint(): UseMutationResult<OutputSchema, APIError, UpdateEprintParams, unknown>

Defined in: web/lib/hooks/use-eprint-mutations.ts:186

Mutation hook for updating eprints.

Returns

UseMutationResult<OutputSchema, APIError, UpdateEprintParams, unknown>

TanStack Query mutation object with mutate, isPending, and error states

Remarks

Validates authorization and computes the new semantic version. On success, invalidates relevant queries. The actual PDS update should be performed by the frontend using the ATProto client.

Example

const { mutate: updateEprint, isPending } = useUpdateEprint();

const handleUpdate = async () => {
try {
const result = await updateEprint({
uri: eprint.uri,
versionBump: 'minor',
title: 'Updated Title',
});
// Use result.version for the PDS call
await atprotoAgent.putRecord(eprint.uri, { ...record, version: result.version });
toast.success('Eprint updated');
} catch (error) {
toast.error('Failed to update eprint');
}
};