diff --git a/survey/src/RootComponent.tsx b/survey/src/RootComponent.tsx index 1ca2223..cc59c25 100644 --- a/survey/src/RootComponent.tsx +++ b/survey/src/RootComponent.tsx @@ -11,6 +11,7 @@ const RootComponent: React.FC = () => { } /> } /> + } /> ) diff --git a/survey/src/components/survey/Survey.tsx b/survey/src/components/survey/Survey.tsx index 95781ab..4856e61 100644 --- a/survey/src/components/survey/Survey.tsx +++ b/survey/src/components/survey/Survey.tsx @@ -1,7 +1,7 @@ import './Survey.css' import * as React from "react"; import {useEffect} from "react"; -import {SurveyDto} from "./../../api/Api"; +import {SurveyDto} from "../../api/Api"; import {Box, Button, Paper, Step, StepContent, StepLabel, Stepper, Typography} from "@mui/material"; import {store} from "../../store/store"; import {setContents, addAnswer} from "../../store/actions/data"; diff --git a/survey/src/pages/NotFoundPage.tsx b/survey/src/pages/NotFoundPage.tsx index dee3d28..ff740e4 100644 --- a/survey/src/pages/NotFoundPage.tsx +++ b/survey/src/pages/NotFoundPage.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { useNavigate } from 'react-router-dom' -import { ROUTES } from '../resources/routes-constants' +import {useNavigate} from 'react-router-dom' +import {ROUTES} from '../resources/routes-constants' const NotFoundPage: React.FC = () => { const navigate = useNavigate() @@ -9,13 +9,25 @@ const NotFoundPage: React.FC = () => { * Call this function to redirect the user to the homepage. */ const redirectToHomePage = () => { - navigate(ROUTES.HOMEPAGE_ROUTE) + const url = new URL(window.location.href) + if (url.host.indexOf('github.io') > 0) { + navigate(ROUTES.GITHUB_PAGES_ROUTE) + } else { + navigate(ROUTES.HOMEPAGE_ROUTE) + } } return ( -
-

Oops 404!

- redirectToHomePage()}> +
+

Oops 404!

+ redirectToHomePage()}> Homepage
diff --git a/survey/src/resources/routes-constants.ts b/survey/src/resources/routes-constants.ts index acd9c75..cb9667e 100644 --- a/survey/src/resources/routes-constants.ts +++ b/survey/src/resources/routes-constants.ts @@ -1,3 +1,4 @@ export const ROUTES = { - HOMEPAGE_ROUTE: '/' + HOMEPAGE_ROUTE: '/', + GITHUB_PAGES_ROUTE: 'tl-esa-tools/' } \ No newline at end of file