Skip to content

Commit

Permalink
revert: switch back to HashRouter
Browse files Browse the repository at this point in the history
GH Pages still does not support SPAs and the recommended approach is to use a Hash Router.
  • Loading branch information
mario-zelger committed Feb 12, 2024
1 parent b95485b commit 11317a5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {createContext, useEffect, useState} from 'react';
import {BrowserRouter as Router, Route, Routes,} from "react-router-dom";
import {HashRouter as Router, Route, Routes} from "react-router-dom";
import {
faBars,
faCalendarDays,
Expand All @@ -23,7 +23,6 @@ import {SectionT} from "./components/Section";
import SectionHashHelper from "./helper/SectionHashHelper";
import SearchPage from "./pages/SearchPage";
import Loading from "./components/Loading";
import LegacyUrlRedirectHelper from "./helper/LegacyUrlRedirectHelper";

export type LinkT = {
title: string
Expand Down Expand Up @@ -84,8 +83,7 @@ function App() {
checkLinks(sections, links)

return <div className='App'>
<Router basename="/hering">
<LegacyUrlRedirectHelper/>
<Router basename="/">
<SectionHashHelper/>
<LinksContext.Provider value={links}>
<div className='header'>
Expand All @@ -95,9 +93,10 @@ function App() {
<main>
<Routes>
<Route path="/" element={<HomePage page={startPage}/>}/>
<Route path="/hering/" element={<HomePage page={startPage}/>}/>
<Route path="search" element={<SearchPage sections={sections}/>}/>
<Route path="calendar" element={<CalendarPage page={calendarPage}/>}/>
<Route path="impressum" element={<ImpressumPage page={impressumPage} />}/>
<Route path="impressum" element={<ImpressumPage page={impressumPage}/>}/>
<Route path=":slug" element={<SectionPage sections={sectionsByKey}/>}/>
</Routes>

Expand Down

0 comments on commit 11317a5

Please sign in to comment.