Deleting posts, Liking images and commenting are now implemented
Users can now delete their posts but not see the delete button when they are seeing someone elses post. The post will then be deleted form the database, this works by deleting it from the users post array and then removing the post document which contains the information about the post and a url to the image, where the image is saved on the storage. This action will update the profile, like their number of posts and the actual post. We can also post comments on the post which uses a custom hook to store the comment in the post document, where we have a comment array. Each comment contains the userId for who posted it and the information about the comment. We will fetch the user with the userId and then use the user information to display the comment with image and name. We will also be able to display the date which we saved when creating the comment. Likes are also implement which will be stored in the post, we store the userId for who has liked the post and not, then when we want to show how many likes we just take the length. We use a custom hook to set the Likes-array by either joining the userId or remove it. We will also use a global state which will update the post and profile when we like and unlike, which works the same way for comments where we also have a global state for adding comments so that the comment section updates when a new comment is added