intershop-pwa
intershop-pwa copied to clipboard
basket empties
When I refresh the page, my basket empties. Is this normal? How to correct this problem? I want to add to cart and keep it even after a refresh.
Hello @bankai14. no, this is not normal - did you accept the use of cookies? No matter, if you are logged in or not the basket should be recovered after page refresh. Do you have any errors in the console?
Yes I accept cookies and I have no error when adding. Everything clears when I refresh the page. @SGrueber
I assume you are not logged in ? The api token for anonymous users is saved as cookie and if the page refreshes it is recovered, so the basket of this user can be fetched again per REST. Please, can you check if the problem occurs if you connect against our demo pwa https://intershoppwa.azurewebsites.net/home ? And whether you have the apitoken
Which OS and browser do you use? @bankai14
that's what's strange because I'm well connected and I have the token but it doesn't work. Is it possible to tell me where the storage happens in the PWA code? @SGrueber
Hi, in the init method of your identity provider (default = icm.identity-provider.ts) the restore$() method of the api-token.service is called. (without parameters or with parameter 'user'). And in the restore$() method the fetching of the basket is triggered: this.store.dispatch(loadBasketByAPIToken({ apiToken: cookie.apiToken })); - maybe you can check whether this action is triggered and if the basket is saved to store. @bankai14
Closed due to inactivity