saleor.io-learn
saleor.io-learn copied to clipboard
Persist token on refresh issue
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);
}