Skip to content

Commit 01f579c

Browse files
Merge branch 'master' of https://github.com/openedx/frontend-app-ora into Ali-Abbas/react-router-upgrade
2 parents 1d8ce7b + f5e7ba4 commit 01f579c

21 files changed

+256
-174
lines changed

src/App.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { Routes, Route } from 'react-router-dom';
22
import { ErrorPage } from '@edx/frontend-platform/react';
33
import { useIntl } from '@edx/frontend-platform/i18n';
44

5-
import AssessmentView from 'views/AssessmentView';
5+
import PeerAssessmentView from 'views/PeerAssessmentView';
6+
import SelfAssessmentView from 'views/SelfAssessmentView';
7+
import StudentTrainingView from 'views/StudentTrainingView';
68
import SubmissionView from 'views/SubmissionView';
79
import messages from './messages';
810
import routes from './routes';
@@ -12,7 +14,9 @@ const RouterRoot = () => {
1214

1315
return (
1416
<Routes>
15-
<Route path={routes.assessment} element={<AssessmentView />} />
17+
<Route path={routes.peerAssessment} element={<PeerAssessmentView />} />
18+
<Route path={routes.selfAssessment} element={<SelfAssessmentView />} />
19+
<Route path={routes.studentTraining} element={<StudentTrainingView />} />
1620
<Route path={routes.submission} element={<SubmissionView />} />
1721
<Route path={routes.root} element={<ErrorPage message={formatMessage(messages.error404Message)} />} />
1822
</Routes>

src/data/services/lms/api/constants.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/data/services/lms/api/hooks.js

Lines changed: 0 additions & 157 deletions
This file was deleted.

src/data/services/lms/hooks/api.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ describe('lms api hooks', () => {
3535
});
3636

3737
const mockUseQueryForORA = (hasData) => {
38+
console.log({ useQuery });
3839
when(useQuery)
3940
.calledWith(expect.objectContaining({ queryKey: [queryKeys.oraConfig] }))
4041
.mockImplementationOnce(mockUseQuery(hasData));
@@ -118,8 +119,8 @@ describe('lms api hooks', () => {
118119
});
119120
describe('assessment', () => {
120121
beforeEach(() => {
121-
mockMatchPath(routes.assessment);
122-
mockUseLocation(routes.assessment);
122+
mockMatchPath(routes.peerAssessment);
123+
mockUseLocation(routes.peerAssessment);
123124
mockUseQueryForPageData(fakeData.pageData.shapes.peerAssessment, true);
124125
out = testUsePageData();
125126
});

src/data/services/lms/hooks/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export const useORAConfig = (): types.QueryData<types.ORAConfig> => {
2525

2626
export const usePageData = (): types.QueryData<types.PageData> => {
2727
const location = useLocation();
28-
const route = matchPath({ path: routes.assessment }, location.pathname);
29-
const isAssessment = !!route && route.pattern.path === routes.assessment;
28+
const route = matchPath({ path: routes.peerAssessment }, location.pathname);
29+
const isAssessment = !!route && route.pattern.path === routes.peerAssessment;
3030
const returnData = isAssessment
3131
? fakeData.pageData.shapes.peerAssessment
3232
: fakeData.pageData.shapes.emptySubmission;

src/routes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export default {
2-
assessment: '/assessment/:id',
2+
peerAssessment: '/peer_assessment/:id',
3+
selfAssessment: '/self_assessment/:id',
4+
studentTraining: '/student_training/:id',
35
submission: '/submission/:id',
46
root: '/*',
57
};

0 commit comments

Comments
 (0)