intershop-pwa icon indicating copy to clipboard operation
intershop-pwa copied to clipboard

basket empties

Open bankai14 opened this issue 2 years ago • 5 comments

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.

AB#80365

bankai14 avatar Oct 14 '22 08:10 bankai14

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?

SGrueber avatar Oct 14 '22 09:10 SGrueber

Yes I accept cookies and I have no error when adding. Everything clears when I refresh the page. @SGrueber

bankai14 avatar Oct 14 '22 10:10 bankai14

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

image

Which OS and browser do you use? @bankai14

SGrueber avatar Oct 14 '22 12:10 SGrueber

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

bankai14 avatar Oct 14 '22 14:10 bankai14

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

SGrueber avatar Oct 17 '22 07:10 SGrueber

Closed due to inactivity

shauke avatar Nov 08 '22 10:11 shauke