diff --git a/src/CourseAuthoringPage.jsx b/src/CourseAuthoringPage.jsx
index b11dcc7948..3e6b50f2e3 100644
--- a/src/CourseAuthoringPage.jsx
+++ b/src/CourseAuthoringPage.jsx
@@ -9,6 +9,7 @@ import { StudioFooter } from '@edx/frontend-component-footer';
import Header from './header';
import { fetchCourseDetail } from './data/thunks';
import { useModel } from './generic/model-store';
+import NotFoundAlert from './generic/NotFoundAlert';
import PermissionDeniedAlert from './generic/PermissionDeniedAlert';
import { getCourseAppsApiStatus } from './pages-and-resources/data/selectors';
import { RequestStatus } from './data/constants';
@@ -50,10 +51,16 @@ const CourseAuthoringPage = ({ courseId, children }) => {
const courseOrg = courseDetail ? courseDetail.org : null;
const courseTitle = courseDetail ? courseDetail.name : courseId;
const courseAppsApiStatus = useSelector(getCourseAppsApiStatus);
- const inProgress = useSelector(state => state.courseDetail.status) === RequestStatus.IN_PROGRESS;
+ const courseDetailStatus = useSelector(state => state.courseDetail.status);
+ const inProgress = courseDetailStatus === RequestStatus.IN_PROGRESS;
const { pathname } = useLocation();
const showHeader = !pathname.includes('/editor');
+ if (courseDetailStatus === RequestStatus.NOT_FOUND) {
+ return (
+
+ );
+ }
if (courseAppsApiStatus === RequestStatus.DENIED) {
return (
diff --git a/src/data/constants.js b/src/data/constants.js
index 5191ea1dfa..bd01f09dda 100644
--- a/src/data/constants.js
+++ b/src/data/constants.js
@@ -13,6 +13,7 @@ export const RequestStatus = {
PENDING: 'pending',
CLEAR: 'clear',
PARTIAL: 'partial',
+ NOT_FOUND: 'not-found',
};
/**
diff --git a/src/data/thunks.js b/src/data/thunks.js
index 9a52d4d89d..9c797dc6a5 100644
--- a/src/data/thunks.js
+++ b/src/data/thunks.js
@@ -21,7 +21,11 @@ export function fetchCourseDetail(courseId) {
canChangeProviders: getAuthenticatedUser().administrator || new Date(courseDetail.start) > new Date(),
}));
} catch (error) {
- dispatch(updateStatus({ courseId, status: RequestStatus.FAILED }));
+ if (error.response && error.response.status === 404) {
+ dispatch(updateStatus({ courseId, status: RequestStatus.NOT_FOUND }));
+ } else {
+ dispatch(updateStatus({ courseId, status: RequestStatus.FAILED }));
+ }
}
};
}
diff --git a/src/generic/NotFoundAlert.jsx b/src/generic/NotFoundAlert.jsx
new file mode 100644
index 0000000000..8ff9cf4fff
--- /dev/null
+++ b/src/generic/NotFoundAlert.jsx
@@ -0,0 +1,14 @@
+import React from 'react';
+import { FormattedMessage } from '@edx/frontend-platform/i18n';
+import { Alert } from '@edx/paragon';
+
+const NotFoundAlert = () => (
+
+
+
+);
+
+export default NotFoundAlert;