Added athentication on DELETE post

pull/21/head^2
Aurian JAULT 10 months ago
parent 83b0a7f93b
commit 68fc3519f7

@ -79,9 +79,11 @@ class PostController extends AbstractController
public function removePost(int $id): Response
{
$post = $this->em->getRepository(Post::class)->find($id);
if($post->getProfil()->getId() === $this->getUser()->getId())
{
$this->em->remove($post);
$this->em->flush();
}
return new Response();
}
}

Loading…
Cancel
Save