Skip to content

Migrate authentication logic from react context to redux store  #387

@Kanakanajm

Description

@Kanakanajm

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.

Metadata

Metadata

Assignees

Labels

RefactoringRestructuring and improving existing code

Type

Projects

Status

📋 Product Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions