This PR ensures that the MyRead page updates when the 'unread book' button is clicked.
If the current link includes /myreads AND the deleteReadBook prop is passed, it will call that function, which will filter out the book in the state of MyBooks which matches the id of the removed book.
I originally considered just checking the /myreads link, but there are some cases where someone may name their Club or BookList "myreads" which would cause this to fail since the way we calculate links would end up like /clubs/myreads which would cause this function to fire incorrectly. For that reason, I ensure that both of them are true.
Description
This PR ensures that the MyRead page updates when the 'unread book' button is clicked.
If the current link includes
/myreads
AND thedeleteReadBook
prop is passed, it will call that function, which will filter out the book in the state of MyBooks which matches the id of the removed book.I originally considered just checking the
/myreads
link, but there are some cases where someone may name their Club or BookList "myreads" which would cause this to fail since the way we calculate links would end up like/clubs/myreads
which would cause this function to fire incorrectly. For that reason, I ensure that both of them are true.