redux-persist-cookie-storage
redux-persist-cookie-storage copied to clipboard
Expiration time doesn't work for store key.
I have in my cookies/store such object:
auth: {
accessToken: 'myToken',
refreshToken: 'myRefreshToken',
}
And I want accessToken to expire from cookies/store after 30 seconds (later on it will be 1h). I'm trying to do it like that:
const authPersistConfig = {
key: 'auth',
storage: new CookieStorage(Cookies, {
expiration: {
'default': null,
'accessToken': 30,
}
}),
};
but the accessToken still exist in cookie after this time. Am I doing something wrong?
storeKey always update expiration when user refresh browser. so not const if set expiration. like in src code always set in default
[update] answer i have found where storeKey not set in expires u must give configuration like this. i using redux-persist v5.10.1
const rootPersistConfig = {
key: 'root',
storage: new CookieStorage(Cookies, {
expiration: {
'persist:root': 120
}
})
};