Skip to content

Commit 963e2e7

Browse files
authored
Fix 403 error popup on page load (#2635)
* Grading overview data should be dispatched in Grading component instead of main Academy component * Respective code has been moved over accordingly
1 parent d7ecd5b commit 963e2e7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/pages/academy/Academy.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Constants from 'src/commons/utils/Constants';
99
import { useTypedSelector } from 'src/commons/utils/Hooks';
1010

1111
import {
12-
fetchGradingOverviews,
1312
fetchNotifications,
1413
updateLatestViewedCourse
1514
} from '../../commons/application/actions/SessionActions';
@@ -33,7 +32,6 @@ const Academy: React.FC<{}> = () => {
3332
const dispatch = useDispatch();
3433
React.useEffect(() => {
3534
dispatch(fetchNotifications());
36-
dispatch(fetchGradingOverviews(false));
3735
}, [dispatch]);
3836

3937
const agreedToResearch = useTypedSelector(state => state.session.agreedToResearch);

src/pages/academy/grading/Grading.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { NonIdealState, Spinner, SpinnerSize } from '@blueprintjs/core';
22
import * as React from 'react';
3+
import { useDispatch } from 'react-redux';
34
import { Navigate, useParams } from 'react-router';
5+
import { fetchGradingOverviews } from 'src/commons/application/actions/SessionActions';
46
import { useTypedSelector } from 'src/commons/utils/Hooks';
57
import { numberRegExp } from 'src/features/academy/AcademyTypes';
68

@@ -16,6 +18,11 @@ const Grading: React.FC = () => {
1618
questionId: string;
1719
}>();
1820

21+
const dispatch = useDispatch();
22+
React.useEffect(() => {
23+
dispatch(fetchGradingOverviews(false));
24+
}, [dispatch]);
25+
1926
// If submissionId or questionId is defined but not numeric, redirect back to the Grading overviews page
2027
if (
2128
(params.submissionId && !params.submissionId?.match(numberRegExp)) ||

0 commit comments

Comments
 (0)