Skip to content

Commit

Permalink
Switch to hash routing.
Browse files Browse the repository at this point in the history
  • Loading branch information
soup-bowl committed Jun 29, 2022
1 parent f25fe25 commit 05c9b8d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Moved CNAME to public folder, to stop the GitHub Pages deployment breaking the URL.
- GitHub 404 added to pick-up users who haven't cached the system first.
- Switched to hashed routing since GitHub web rules are not available, to help reduce 404s.

## [0.2.7] (pre-release) - 2022-06-20
### Added
Expand Down
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { HashRouter, Routes, Route, Navigate } from 'react-router-dom';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';

import Layout from "./pages/_layout";
Expand All @@ -12,7 +12,7 @@ import StringConversionPage from './pages/converter';

export default function App() {
return (
<BrowserRouter>
<HashRouter>
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<Home />} />
Expand All @@ -27,7 +27,7 @@ export default function App() {
<Route path="*" element={<Navigate replace to="/" />} />
</Route>
</Routes>
</BrowserRouter>
</HashRouter>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/dnschecker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function DnsCheckResult() {
const [errResult, setErrResult] = useState<any>(undefined);

useEffect(() => {
let inputs = window.location.pathname.slice(5).split('/');
let inputs = window.location.hash.slice(6).split('/');
setProtocol(inputs[0]);
setDnsUrl(inputs[1]);
}, []);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/inspection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function InspectionHome() {
};

export function InspectonResult() {
let inspectionURL = window.location.pathname.slice(9);
let inspectionURL = window.location.hash.slice(10);
const navigate = useNavigate();

const [siteDetails, setSiteDetails] = useState<any>([]);
Expand Down

0 comments on commit 05c9b8d

Please sign in to comment.