-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
28 lines (24 loc) · 668 Bytes
/
App.tsx
File metadata and controls
28 lines (24 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { HashRouter, Routes, Route } from "react-router-dom";
import AppLinkPage from "./pages/AppLinkPage";
import { useEffect } from "react";
function RootRedirect() {
useEffect(() => {
const slug = localStorage.getItem("clientSlug");
if (slug) {
window.location.hash = `#/app/${slug}`;
}
}, []);
return <div>Loading app...</div>;
}
function App() {
return (
<HashRouter>
<Routes>
<Route path="/" element={<RootRedirect />} />
<Route path="/app/:clientSlug" element={<AppLinkPage />} />
<Route path="*" element={<div>404 Not Found</div>} />
</Routes>
</HashRouter>
);
}
export default App;