-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add defaultState
option to remove a cookie for a specified default state
#17
Comments
|
who can help me? |
me too, i need to remove the cookie if authentication fail |
Hi both, What do you think @zhangwei900808 @trangchongcheng? |
@bjoluc I know you said , but this a new problem , is when my token is expired axios status is 401 and axios file is not in reducer So I cant reset reducer when status = 401, do you have any methods to resolve it?
|
@zhangwei900808 I think you should be using redux-thunk to invoke axios in a context where you can dispatch Redux actions. next-redux-cookie-wrapper is designed to mirror Redux state changes to cookies and use them to share state between client and server, not to mirror cookie state changes to Redux (this only ever happens when the server updates cookies on page transitions). Hence you'll have to dispatch a Redux action when axios gets the response, and thunk actions are a good place to do so. You may find https://github.com/reduxjs/redux-thunk#why-do-i-need-this helpful. |
@bjoluc I had resolve this problem and I read this article helped me React + Redux: Refresh Token with Axios and JWT example store/index.js
axios.js
setupInterceptors.js
authSlices.js
|
Great, let's re-open this as a feature request anyway – I think it may be useful :) |
defaultState
option to remove a cookie for a specified default state
is there any update on this? I also need to clear cookies when doing logout. Or atleast could we have some workaround to implement logout ? |
Hi @bryantobing12, |
Well, for now it's working fine at my case. And i can clear the cookies manually from the client. |
@bjoluc I was thinking that it would be nice if we can expose |
## [2.2.0](v2.1.2...v2.2.0) (2022-08-22) ### Features * Add `defaultState` option to remove a cookie for a specified default state ([9f0c224](9f0c224)), closes [#17](#17) [#17](#17) * Add support for custom serialization functions ([#41](#41)) ([0bae6e9](0bae6e9)) ### Bug Fixes * Avoid redundant Set-Cookie headers in server responses ([8b48978](8b48978))
🎉 This issue has been resolved in version 2.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
when I login is success save cookie but how can I clear cookie when I logout?
The text was updated successfully, but these errors were encountered: