-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.tsx
53 lines (49 loc) · 1.94 KB
/
index.tsx
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* @refresh reload */
// START POLLYFILL GLOBALS
import 'core-js/actual';
// END POLLYFILL GLOBALS
import './index.css';
import { render } from 'solid-js/web';
import { Route, Router } from '@solidjs/router';
import { registerSW } from 'virtual:pwa-register'
import Wrapper from './wrapper';
import Login from './routes/login';
import Logout from './routes/logout';
import Shelf from './routes/[username]/[...path]';
import User from './routes/[username]/(user)';
import MainApp from './MainApp';
import ScratchPad from './routes/scratch-pad';
import Profile from './routes/profile';
import Home from './routes/(home)';
import Signup from './routes/signup';
import { RequireApiSetupGuard, RequireAuthGuard, RequireNoAuthGuard, RequireSignupAllowedGuard } from './contexts/ApiProvider';
if ("serviceWorker" in navigator) {
registerSW()
} else {
console.debug("Service Worker capability not found in browser, so not using")
}
const root = document.getElementById('root')!
root.innerHTML = ""
import("../renderer/pkg").then(() => { console.debug("wasm backend loaded") })
render(() => (
<Router>
<Route path="/" component={Wrapper}>
<Route path="/" component={() => <RequireApiSetupGuard><Home /></RequireApiSetupGuard>} />
<Route path="/scratch-pad" component={ScratchPad} />
<Route component={RequireNoAuthGuard}>
<Route path="/signup" component={() => <RequireSignupAllowedGuard><Signup /></RequireSignupAllowedGuard>} />
<Route path="/login" component={Login} />
</Route>
<Route component={RequireAuthGuard}>
<Route path="/logout" component={Logout} />
<Route path="/profile" component={Profile} />
</Route>
<Route component={RequireApiSetupGuard}>
<Route path="/" component={MainApp}>
<Route path="/:username" component={User} />
<Route path="/:username/:bookSlug?/:noteSlug?" component={Shelf} />
</Route>
</Route>
</Route>
</Router>
), root);