proshop_django icon indicating copy to clipboard operation
proshop_django copied to clipboard

About cart items

Open diplovkhatri opened this issue 3 years ago • 3 comments

Thanks for providing this course i am grateful to you but i found one issue on this course. The issue is: when ever one user add items to the cart each and every users have the same item to their cart so please can you provide the solution for this solution

diplovkhatri avatar Jul 27 '21 14:07 diplovkhatri

Hey diplovkhatri, you can just add this localStorage.removeItem('userInfo'); localStorage.removeItem('cartItems'); localStorage.removeItem('shippingAddress'); localStorage.removeItem('paymentMethod');

This will be in src/actions/userActions.js. Just look for export const logout = () => (dispatch) => { and add the rest! You can look at brads github since dennis sucks. https://github.com/bradtraversy/proshop_mern/blob/master/frontend/src/actions/userActions.js keep in mind don't just copy everything something will break so you have to look at the difference in the code but everything should work fine!

Gabriel7553 avatar Jul 27 '21 17:07 Gabriel7553

Thank you for your reply. I did the same things what you said but it didn't seems to be working . only 'shipping Address' and 'payment Method' seems to be removing from 'local storage' but 'cart Items' seems to remaning same and after i login from another account there is nothings just blank to local storage so that i should enter shipping address for every accounts .I didn't find whats going wrong with this

diplovkhatri avatar Jul 28 '21 07:07 diplovkhatri

Thank you for your reply. I did the same things what you said but it didn't seems to be working . only 'shipping Address' and 'payment Method' seems to be removing from 'local storage' but 'cart Items' seems to remaning same and after i login from another account there is nothings just blank to local storage so that i should enter shipping address for every accounts .I didn't find whats going wrong with this

If you want send me a link of your github or screenshot or look at the github I sent you and compare your code!

Gabriel7553 avatar Jul 28 '21 17:07 Gabriel7553