diff --git a/src/state/queries/post.ts b/src/state/queries/post.ts index 4024001a90..7fa85d586a 100644 --- a/src/state/queries/post.ts +++ b/src/state/queries/post.ts @@ -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({ @@ -344,7 +347,9 @@ export function usePostDeleteMutation() { }, onSuccess(_, variables) { updatePostShadow(queryClient, variables.uri, {isDeleted: true}) + onSuccess?.() }, + onError, }) }