You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
thunk
s so it could usegetState
, 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.
The text was updated successfully, but these errors were encountered: