diff --git a/client/components/app/Post/Dropdown.jsx b/client/components/app/Post/Dropdown.jsx index 568f0cb..0b60073 100644 --- a/client/components/app/Post/Dropdown.jsx +++ b/client/components/app/Post/Dropdown.jsx @@ -80,27 +80,29 @@ export default function Dropdown({ post, setPost, onDelete }) { {(user.id === post.author.id || user.role === 'admin') && ( - <> - - - - - çöpü düzenle - - - - {isDeleting ? ( - - ) : ( - - )} - çöpü kaldır - - + + )} + {user.id === post.author.id && ( + + + + çöpü düzenle + + + )} + {(user.id === post.author.id || user.role === 'admin') && ( + + {isDeleting ? ( + + ) : ( + + )} + çöpü kaldır + )} diff --git a/client/components/app/Post/UpdateModal.jsx b/client/components/app/Post/UpdateModal.jsx index dbea6f5..9434527 100644 --- a/client/components/app/Post/UpdateModal.jsx +++ b/client/components/app/Post/UpdateModal.jsx @@ -1,3 +1,4 @@ +import { useRouter } from 'next/navigation'; import { useState } from 'react'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -30,6 +31,7 @@ const formSchema = z.object({ }); export default function UpdateModal({ post, setPost, setIsOpen }) { + const router = useRouter(); const [isSubmitting, setIsSubmitting] = useState(false); const { toast } = useToast(); @@ -67,6 +69,8 @@ export default function UpdateModal({ post, setPost, setIsOpen }) { description: 'çöp başarıyla düzenlendi.', duration: 3000 }); + router.push(`/app/posts/${post.id}`); + router.refresh(); } return ( diff --git a/client/components/app/Post/index.jsx b/client/components/app/Post/index.jsx index 493ac83..0ab98a5 100644 --- a/client/components/app/Post/index.jsx +++ b/client/components/app/Post/index.jsx @@ -1,3 +1,5 @@ +'use client'; + import { usePathname } from 'next/navigation'; import { useState } from 'react'; import Markdown from 'react-markdown';