Skip to content
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

Indirect logout case #29

Open
hegdeashwin opened this issue Nov 15, 2016 · 1 comment
Open

Indirect logout case #29

hegdeashwin opened this issue Nov 15, 2016 · 1 comment

Comments

@hegdeashwin
Copy link

hegdeashwin commented Nov 15, 2016

Once I logged in I am able to see dashboard and if i change the route to /login it redirects me to dashboard as you are already logged in and your token is present in cookie.

Now, instead of hitting logout say support I delete the token cookie or clean local storage and then after if I refresh the browser it should redirect me to login instead of dashboard.

Well, I am trying to do some thing as below, in my router file where i have defined my routes:

...
function shouldRedirectToLogin(nextState, replace) {
  console.log('nextState: ', nextState);

  if (!auth.isLoggedIn()) {
    replace({
      pathname: '/login',
      state: { nextPathname: nextState.location.pathname }
    })
  }
}
...

I am getting bellow error, I am using React, Redux and React-Router.

browser.js:49 Warning: You cannot use state without a queryKey it will be dropped
@hegdeashwin
Copy link
Author

Now, instead of hitting logout say support I delete the token cookie or clean local storage and then after if I refresh the browser it should redirect me to login instead of dashboard.

I was able to fix this issue by adding res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0'); in my logout response header.

browser.js:49 Warning: You cannot use state without a queryKey it will be dropped
This is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant