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

Migrate authentication logic from react context to redux store #387

Open
Kanakanajm opened this issue Nov 14, 2024 · 0 comments
Open

Migrate authentication logic from react context to redux store #387

Kanakanajm opened this issue Nov 14, 2024 · 0 comments
Assignees
Labels

Comments

@Kanakanajm
Copy link
Collaborator

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.

@Kanakanajm Kanakanajm self-assigned this Nov 14, 2024
@Kanakanajm Kanakanajm linked a pull request Nov 30, 2024 that will close this issue
14 tasks
@Kanakanajm Kanakanajm removed a link to a pull request Nov 30, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant