-
Notifications
You must be signed in to change notification settings - Fork 228
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 use of frontend-lib-special-exams public API to use hooks. #1284
Refactor use of frontend-lib-special-exams public API to use hooks. #1284
Conversation
c829607
to
ff7f9cd
Compare
@@ -12,14 +12,23 @@ export const stateKeys = StrictDict({ | |||
const useExamAccess = ({ | |||
id, | |||
}) => { | |||
const [accessToken, setAccessToken] = useKeyedState(stateKeys.accessToken, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer need to maintain this as state, since the useExamAccessToken
hook takes care of getting the updated values from the specialExams
store.
@@ -1,98 +0,0 @@ | |||
import React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff is showing up this way, because I had to rename this from a js
file to a jsx
file.
@@ -0,0 +1,88 @@ | |||
import { logError } from '@edx/frontend-platform/logging'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the article How to test custom React hooks to decide how to test this hook. I decided to focus on testing the return values instead of the internals of the hook, since that may change (as it did in this pull request). I think these tests will be more stables this way.
This commit refactors the use of the frontend-lib-special-exams public API to use hooks. This commit also imports the root reducer from the frontend-lib-special-exams library. This root reducer is used for the specialExams slice when configuring the store for this application.
64fa556
to
a8fcd75
Compare
Description:
Jira: COSMO-175
NOTE: The corresponding pull request in
frontend-lib-special-exams
is a prerequisite to these changes: openedx/frontend-lib-special-exams#134. Those changes must be merged and deployed and the version of the library updated here before these changes can be merged.This commit refactors the use of the
frontend-lib-special-exams
public API to use hooks.This commit also imports the root reducer from the
frontend-lib-special-exams
library. This root reducer is used for the specialExams slice when configuring the store for this application.