add onSuccess/onError to delete post mutation

This commit is contained in:
Samuel Newman
2026-03-19 11:12:27 +02:00
parent 4b06c82b37
commit 9b311aa68a
+6 -1
View File
@@ -335,7 +335,10 @@ function usePostUnrepostMutation(
})
}
export function usePostDeleteMutation() {
export function usePostDeleteMutation({
onSuccess,
onError,
}: {onSuccess?: () => void; onError?: (error: Error) => void} = {}) {
const queryClient = useQueryClient()
const agent = useAgent()
return useMutation<void, Error, {uri: string}>({
@@ -344,7 +347,9 @@ export function usePostDeleteMutation() {
},
onSuccess(_, variables) {
updatePostShadow(queryClient, variables.uri, {isDeleted: true})
onSuccess?.()
},
onError,
})
}