Description
Since the authentication logic is contained withing the AuthProvider, accessing access token requires the useContext hook. React forbids using hook outside of a function component. That said, we cannot get the token in our services (rtk queries). The workaround currently is to pass the token to the query/mutation function as a parameter which is not ideal due to duplicated code. Instead of using native react context, we can store authentication info in a redux slice and consume the state by calling getState when defining any query/mutation.