If user is a teacher they can edit or delete posts
If a user is a student they can only edit or delete their own posts
Implementation
The edit and delete buttons will be added in the post component and will be conditionally rendered according to the role of the user who is logged in/created the post
A route will be made for an edit component with the path /posts/:id/edit and the edit button will be encapsulated in an appropriate link
In the edit component will be a form displaying the current post content as a placeholder
A submit button will be present, which when clicked will create a PATCH request and the user will be taken back to the post feed via navigate
On clicking the delete button DELETE request will be made for that post and the user will be taken back to the post feed via navigate
Requirements
Implementation
post
component and will be conditionally rendered according to the role of the user who is logged in/created the postedit
component with the path/posts/:id/edit
and theedit
button will be encapsulated in an appropriate linkedit
component will be a form displaying the current post content as a placeholdersubmit
button will be present, which when clicked will create a PATCH request and the user will be taken back to the post feed vianavigate
delete
button DELETE request will be made for that post and the user will be taken back to the post feed vianavigate