Skip to content
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: 2 additions & 0 deletions site.config.build.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';
import { authnApp } from '@openedx/frontend-app-authn';
import { learnerDashboardApp } from '@openedx/frontend-app-learner-dashboard';
import homeApp from './src/homeApp';

import './src/site.scss';

Expand All @@ -19,6 +20,7 @@ const siteConfig: SiteConfig = {
footerApp,
authnApp,
learnerDashboardApp,
homeApp,
],
externalRoutes: [
{
Expand Down
2 changes: 2 additions & 0 deletions site.config.dev.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';
import { authnApp } from '@openedx/frontend-app-authn';
import { learnerDashboardApp } from '@openedx/frontend-app-learner-dashboard';
import homeApp from './src/homeApp';

import './src/site.scss';

Expand All @@ -19,6 +20,7 @@ const siteConfig: SiteConfig = {
footerApp,
authnApp,
learnerDashboardApp,
homeApp,
],
externalRoutes: [
{
Expand Down
18 changes: 18 additions & 0 deletions src/homeApp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { App, getUrlByRouteRole } from '@openedx/frontend-base';
import { redirect } from 'react-router';

const homeApp: App = {
appId: 'home',
routes: [{
path: '/',
loader: () => {
const dashboardUrl = getUrlByRouteRole('org.openedx.frontend.role.dashboard');
if (dashboardUrl) {
return redirect(dashboardUrl);
}
throw new Response('Not Found', { status: 404 });
},
}],
};

export default homeApp;