This commit is contained in:
Magnus Åhall 2024-11-30 17:10:46 +01:00
parent 9a164b984a
commit 5c2842c995
8 changed files with 330 additions and 26 deletions

View file

@ -8,6 +8,7 @@ import htm from 'htm'
import 'preact/debug'
import 'preact/devtools'
{{- end }}
import { NodeStore } from 'node_store'
import { Notes2 } from "/js/{{ .VERSION }}/app.mjs"
import { API } from 'api'
@ -15,8 +16,15 @@ if (!API.hasAuthenticationToken()) {
location.href = '/login'
} else {
const html = htm.bind(h)
window._notes2 = createRef()
render(html`<${Notes2} ref=${window._notes2} />`, document.getElementById('app'))
try {
window.nodeStore = new NodeStore()
window.nodeStore.initializeDB().then(() => {
window._notes2 = createRef()
render(html`<${Notes2} ref=${window._notes2} />`, document.getElementById('app'))
})
} catch (e) {
alert(e)
}
}
</script>