Open chen-fang-1992 opened 6 years ago
as the error says, you need transforms on the persistReducer config, not the persistStore config. The redux-persist-transform-expire are probably not updated for redux-persist v5 yet.
I've tried to put transforms into persistReducer config, while it still doesn't work. It seems redux-persist-transform-expire is only compatible with v4.
My situation is that I need to persist users login state in my web app, otherwise it will be lost when refresh page. However, if I use redux-persist, the state will be persist locally like forever. If users forget to click logout, the session will expire at server anyway while the client-side won't expire.
Any kind advice is appreciated. Thanks.
I've tried sessionStorage instead of localStorage. Here is another problem, if I close browser tab, the session will be ended by redux-persist while the session at server is still alive.
options:
as the error says, you need transforms on the persistReducer config, not the persistStore config. The redux-persist-transform-expire are probably not updated for redux-persist v5 yet.
but it's ur example, i also encountered the same problem.
I tried use redux-persist-transform-expire, while I received a error:
redux-persist: invalid option passed to persistStore: "transforms". You may be incorrectly passing persistConfig into persistStore, whereas it should be passed into persistReducer.
How can I set expiry for my reducer either in 30 minutes or on browser closing?