divanov11 / proshop_django

403 stars 426 forks source link

About cart items #17

Open diplovkhatri opened 2 years ago

diplovkhatri commented 2 years ago

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

Gabriel7553 commented 2 years ago

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!

diplovkhatri commented 2 years ago

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

Gabriel7553 commented 2 years ago

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!