better for github pages
This commit is contained in:
parent
1d9660b133
commit
8c925473cb
@ -11,6 +11,7 @@ const RootComponent: React.FC = () => {
|
||||
<Routes>
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
<Route path={ROUTES.HOMEPAGE_ROUTE} element={<HomePage />} />
|
||||
<Route path={ROUTES.GITHUB_PAGES_ROUTE} element={<HomePage />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
)
|
||||
|
@ -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";
|
||||
|
@ -9,11 +9,23 @@ const NotFoundPage: React.FC = () => {
|
||||
* Call this function to redirect the user to the homepage.
|
||||
*/
|
||||
const redirectToHomePage = () => {
|
||||
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 (
|
||||
<div style={{ position: 'relative', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}>
|
||||
<div style={{
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column'
|
||||
}}>
|
||||
<h1 style={{fontSize: '4em'}}>Oops 404!</h1>
|
||||
<span style={{cursor: 'pointer'}} onClick={() => redirectToHomePage()}>
|
||||
Homepage
|
||||
|
@ -1,3 +1,4 @@
|
||||
export const ROUTES = {
|
||||
HOMEPAGE_ROUTE: '/'
|
||||
HOMEPAGE_ROUTE: '/',
|
||||
GITHUB_PAGES_ROUTE: 'tl-esa-tools/'
|
||||
}
|
Loading…
Reference in New Issue
Block a user