From af6c1a2cc350e3b6a5b991c183bbafbdbe9bd7c0 Mon Sep 17 00:00:00 2001 From: Fr3akymurk Date: Tue, 27 Feb 2024 19:33:48 +0100 Subject: [PATCH] Overall fixes, read the comment. --- src/app/(main)/editor/[postId]/_components/post-editor.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/(main)/editor/[postId]/_components/post-editor.tsx b/src/app/(main)/editor/[postId]/_components/post-editor.tsx index 45fe7c3..f2986df 100644 --- a/src/app/(main)/editor/[postId]/_components/post-editor.tsx +++ b/src/app/(main)/editor/[postId]/_components/post-editor.tsx @@ -58,12 +58,10 @@ export const PostEditor = ({ post, user }: Props) => { const onSubmit = form.handleSubmit(async (values) => { if (user.id == post.userId) { updatePost.mutate({ id: post.id, ...values }); + toast('Saved the post successfully.'); return; } - if (!user) { - toast('You need to log in to edit this post.'); - return; - } + toast('You do not have permission to edit this post.'); return; });