First alpha
This commit is contained in:
43
src/index.tsx
Executable file
43
src/index.tsx
Executable file
@ -0,0 +1,43 @@
|
||||
import { h, render } from 'preact';
|
||||
import App from './components/App';
|
||||
|
||||
// import "mini.css/src/flavors/mini-dark.scss"
|
||||
import "mini.css/src/flavors/mini-default.scss"
|
||||
import "./index.scss"
|
||||
import Navigation from './navigation';
|
||||
import VaultsPage from './components/routes/vaults/Vaults';
|
||||
import { Page } from './page';
|
||||
|
||||
import Notes from "./notes"
|
||||
import DemoPage from './components/demo';
|
||||
import VaultPage from './components/routes/vault/Vault';
|
||||
console.log(Notes);
|
||||
|
||||
(async () => {
|
||||
// Initialize notes provider
|
||||
if (Notes.loginRequired()) {
|
||||
let url = new URL(location.href)
|
||||
let code = url.searchParams.get("code");
|
||||
|
||||
if (code) {
|
||||
let err = await Notes.getToken(code)
|
||||
if (err) {
|
||||
alert("Login failed: " + err)
|
||||
Notes.login()
|
||||
} else {
|
||||
window.history.replaceState(null, document.title, "/" + window.location.hash);
|
||||
}
|
||||
} else {
|
||||
Notes.login()
|
||||
}
|
||||
}
|
||||
|
||||
await Notes.start();
|
||||
|
||||
Navigation.default = VaultsPage as typeof Page;
|
||||
Navigation.addPage("/vault", VaultPage as typeof Page)
|
||||
Navigation.addPage("/demo", DemoPage as typeof Page)
|
||||
Navigation.start();
|
||||
|
||||
render(<App />, document.body, document.getElementById('app'));
|
||||
})()
|
Reference in New Issue
Block a user