Skip to content

Fix 403 error popup on page load #2635

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

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/pages/academy/Academy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Constants from 'src/commons/utils/Constants';
import { useTypedSelector } from 'src/commons/utils/Hooks';

import {
fetchGradingOverviews,
fetchNotifications,
updateLatestViewedCourse
} from '../../commons/application/actions/SessionActions';
Expand All @@ -33,7 +32,6 @@ const Academy: React.FC<{}> = () => {
const dispatch = useDispatch();
React.useEffect(() => {
dispatch(fetchNotifications());
dispatch(fetchGradingOverviews(false));
}, [dispatch]);

const agreedToResearch = useTypedSelector(state => state.session.agreedToResearch);
Expand Down
7 changes: 7 additions & 0 deletions src/pages/academy/grading/Grading.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { NonIdealState, Spinner, SpinnerSize } from '@blueprintjs/core';
import * as React from 'react';
import { useDispatch } from 'react-redux';
import { Navigate, useParams } from 'react-router';
import { fetchGradingOverviews } from 'src/commons/application/actions/SessionActions';
import { useTypedSelector } from 'src/commons/utils/Hooks';
import { numberRegExp } from 'src/features/academy/AcademyTypes';

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

const dispatch = useDispatch();
React.useEffect(() => {
dispatch(fetchGradingOverviews(false));
}, [dispatch]);

// If submissionId or questionId is defined but not numeric, redirect back to the Grading overviews page
if (
(params.submissionId && !params.submissionId?.match(numberRegExp)) ||
Expand Down