misc: add post deletion toast

This commit is contained in:
Xyphyn committed 2023-07-30 11:56:44 -07:00
1 parent eb1d90478e
commit 32712689d1
1 file changed
+16 -5
@@ -36,11 +36,22 @@
async function deletePost() { async function deletePost() {
if (!$authData) return if (!$authData) return
await getClient().deletePost({ try {
auth: $authData.token, await getClient().deletePost({
deleted: true, auth: $authData.token,
post_id: post.post.id, deleted: true,
}) post_id: post.post.id,
})
toast({
content: 'That post was deleted.',
type: ToastType.success,
})
} catch (err) {
toast({
content: err as any,
type: ToastType.error,
})
}
} }
async function save(post: PostView) { async function save(post: PostView) {