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";
|
||||
|
@ -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 (
|
||||
<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()}>
|
||||
<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
|
||||
</span>
|
||||
</div>
|
||||
|
@ -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