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 BarTop Singleton's use of accessToken #95

Open
jamesvclements opened this issue Feb 7, 2018 · 0 comments
Open

Refactor BarTop Singleton's use of accessToken #95

jamesvclements opened this issue Feb 7, 2018 · 0 comments

Comments

@jamesvclements
Copy link
Contributor

For authentication, the BarTop API singleton relies on the users' accessToken. When the user logs in, we set that token in our authentication redux state. But we want the BarTop API singleton to have access to it.

It would be repetitive to pass in the token from the state for every authenticated API call. We'd have to make every authenticated a thunks so it could use getState, and then dispatch the [CALL_API] actions and pass the token.

But because the accessToken is synced with storage, the BarTop API singleton needs to also read storage & keep in sync with our redux state, which is lame.

I'm not sure the best solution for this yet, but I'm sure there's something cleaner than that second option which is what we're doing now.

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