From 5bdc3244bdfd1987e1d68d774da9743ab61322c7 Mon Sep 17 00:00:00 2001 From: Jennie Robinson Faber Date: Tue, 14 Apr 2026 17:14:22 +0100 Subject: [PATCH] fix(board): handle submit errors + tolerate tag fetch failure --- app/pages/board.vue | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/pages/board.vue b/app/pages/board.vue index 4448e95..0629e39 100644 --- a/app/pages/board.vue +++ b/app/pages/board.vue @@ -93,6 +93,7 @@ definePageMeta({ middleware: ['members-auth'] }) const { memberData } = useAuth() const { posts, loading, fetchPosts, createPost, updatePost, deletePost } = useBoardPosts() const { channels, fetchChannels } = useBoardChannels() +const toast = useToast() const cooperativeTags = ref([]) const showTagsDrawer = ref(false) @@ -150,12 +151,20 @@ const handleDelete = async (post) => { } const handleSubmit = async (body) => { - if (editingPost.value) { - await updatePost(editingPost.value._id, body) - } else { - await createPost(body) + try { + if (editingPost.value) { + await updatePost(editingPost.value._id, body) + } else { + await createPost(body) + } + closeForm() + } catch (err) { + toast.add({ + title: editingPost.value ? 'Failed to update post' : 'Failed to create post', + description: err?.data?.message || err?.message || 'Please try again.', + color: 'red', + }) } - closeForm() } const loadTags = async () => { @@ -174,7 +183,7 @@ useHead({ }) onMounted(async () => { - await Promise.all([loadTags(), fetchPosts(), fetchChannels()]) + await Promise.allSettled([loadTags(), fetchPosts(), fetchChannels()]) })