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

Use a reducer for the current auth state #8

Closed
breqdev opened this issue Sep 23, 2021 · 1 comment
Closed

Use a reducer for the current auth state #8

breqdev opened this issue Sep 23, 2021 · 1 comment

Comments

@breqdev
Copy link
Owner

breqdev commented Sep 23, 2021

https://reactjs.org/docs/hooks-reference.html#usereducer

The reducer should probably have these actions:

  • clear: remove the currently stored token, logging out the user
  • set: set the current access and refresh tokens based on a new login
  • refresh: set the access token but retain the refresh token

This should make the logic cleaner.

@breqdev
Copy link
Owner Author

breqdev commented Sep 24, 2021

Doesn't play well with useLocalStorageState

@breqdev breqdev closed this as completed Sep 24, 2021
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