saleor.io-learn icon indicating copy to clipboard operation
saleor.io-learn copied to clipboard

Persist token on refresh issue

Open amityweb opened this issue 2 years ago • 0 comments

This page https://learn.saleor.io/checkout/checkout-creation/ at the bottom says: At this stage, the checkout session exists in the application state as long as you don't refresh the page

I can see this is because on refresh the code will generate a new token each time! This results in the cart being cleared out.

I cannot see anywhere on the checkout docs where you fix this issue and make it persist on page refresh.

I used the following code which works, not sure if its the correct approach:

if(token == undefined)
{
    setToken(token);
}

amityweb avatar Sep 28 '22 08:09 amityweb