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

[refactor] remove useless conditional in Redux/index.js::checkLogin #44

Open
ortonomy opened this issue Feb 9, 2018 · 0 comments
Open

Comments

@ortonomy
Copy link
Owner

ortonomy commented Feb 9, 2018

if ( c.get('jwt') ) {
    const jwt = c.get('jwt');
    Debug.log('[checkLogin:getCookie] HYDRATESTATE', jwt);
    if ( jwt ) { // this is redundant
      const userDetails = await API.isLoggedIn(jwt);
      return userDetails ? { userDetails: userDetails, jwt: jwt } : { userDetails: null, jwt: null };
    }
  }

rewrite to:

if ( c.get('jwt') ) {
    Debug.log('[checkLogin:getCookie] HYDRATESTATE', c.get('jwt'));
    const userDetails = await API.isLoggedIn(c.get('jwt'));
    return userDetails ? { userDetails: userDetails, jwt: c.get('jwt') } : { userDetails: null, jwt: null };
}   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant