fix(board): surface delete errors via toast
This commit is contained in:
parent
5fb069a80e
commit
6f3d088763
1 changed files with 9 additions and 1 deletions
|
|
@ -147,7 +147,15 @@ const handleDelete = async (post) => {
|
||||||
if (typeof window === 'undefined') return
|
if (typeof window === 'undefined') return
|
||||||
const ok = window.confirm('Delete this post? This cannot be undone.')
|
const ok = window.confirm('Delete this post? This cannot be undone.')
|
||||||
if (!ok) return
|
if (!ok) return
|
||||||
await deletePost(post._id)
|
try {
|
||||||
|
await deletePost(post._id)
|
||||||
|
} catch (err) {
|
||||||
|
toast.add({
|
||||||
|
title: 'Failed to delete post',
|
||||||
|
description: err?.data?.message || err?.message || 'Please try again.',
|
||||||
|
color: 'red',
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = async (body) => {
|
const handleSubmit = async (body) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue