36 lines
839 B
Go Template
36 lines
839 B
Go Template
{{ define "page" }}
|
|
<div id="notes2"></div>
|
|
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/notes2.css">
|
|
|
|
<script type="module">
|
|
import { h, Component, render, createRef } from 'preact'
|
|
import htm from 'htm'
|
|
{{ if .Data._dev -}}
|
|
import 'preact/debug'
|
|
import 'preact/devtools'
|
|
{{- end }}
|
|
import { NodeStore } from 'node_store'
|
|
import { Notes2 } from "/js/{{ .VERSION }}/notes2.mjs"
|
|
import { API } from 'api'
|
|
import { Sync } from 'sync'
|
|
|
|
window.Sync = Sync
|
|
|
|
if (!API.hasAuthenticationToken()) {
|
|
location.href = '/login'
|
|
} else {
|
|
const html = htm.bind(h)
|
|
try {
|
|
window.nodeStore = new NodeStore()
|
|
window.nodeStore.initializeDB().then(() => {
|
|
window._notes2 = createRef()
|
|
render(html`<${Notes2} ref=${window._notes2} />`, document.getElementById('notes2'))
|
|
})
|
|
} catch (e) {
|
|
alert(e)
|
|
}
|
|
}
|
|
</script>
|
|
|
|
{{ end }}
|