diff --git a/package.json b/package.json index 85faee90..535dbaf5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photon-lemmy", - "version": "0.1.1", + "version": "0.2.1", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index 0ffe7d10..fd1fa6fd 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -1,5 +1,13 @@ +{#if editing} + { + if (!$authData || newComment.length <= 0) return + + try { + await getClient().editComment({ + auth: $authData.token, + comment_id: node.comment_view.comment.id, + content: newComment, + }) + + node.comment_view.comment.content = newComment + + editing = false + + toast({ + content: + 'Successfully edited comment. You may need to refresh to see changes.', + type: ToastType.success, + }) + } catch (err) { + toast({ + // @ts-ignore i hate this + content: err, + type: ToastType.error, + }) + } + }} + > + Edit comment +