Added feature in single part component that displays the quantity of that item in the cart (if the quantity is more than 0)
Fixed bug where the contents of a logged in user's cart was doubling every time the page was refreshed.
I did this by
Creating a cart thunk to merge the front end and back end carts. This logic had already been written, but it previously had been part of the me thunk, so I made it its own thunk in the cart reducer. this just seemed more orderly.
Moving the dispatch of the merge-front-end-back-end cart thunk from the me() thunk into the authenticate thunk. That way carts will only be compared and added together/merged at the time of log in, rather than on every refresh.
To be able to call the merge-front-end-back-end cart thunk from within the authenticate thunk I needed to get access to the user id. To do that I needed to make an axios call to get user info within the authenticate thunk (instead of waiting until the authenticate thunk dispatched the me thunk). Once I'd done this in the authenticate thunk there was no point in dispatching the me thunk from within the authenticate thunk. So that aspect of our code is a little less modular. but also less buggy.
Added feature in single part component that displays the quantity of that item in the cart (if the quantity is more than 0)
Fixed bug where the contents of a logged in user's cart was doubling every time the page was refreshed. I did this by