show the error to the user when deleting a post

This commit is contained in:
Massedil
2025-06-18 18:14:28 +02:00
parent d4c28a113a
commit 1f8dc18feb
2 changed files with 21 additions and 4 deletions

View File

@@ -452,8 +452,11 @@ const openDeletePostModal = async (): Promise<void> => {
const router = useRouter();
const { mutate: deletePost, onDone: onDeletePostDone } =
useMutation(DELETE_POST);
const {
mutate: deletePost,
onDone: onDeletePostDone,
onError: onDeletePostError,
} = useMutation(DELETE_POST);
onDeletePostDone(({ data }) => {
if (data && post.value?.attributedTo) {
@@ -465,6 +468,11 @@ onDeletePostDone(({ data }) => {
});
}
});
onDeletePostError((error) => {
console.error(error);
alert(error.message);
});
</script>
<style lang="scss" scoped>
@use "@/styles/_mixins" as *;