feat: add basic UI

This commit is contained in:
Vlad Stan 2023-02-06 14:03:15 +02:00
parent 5a747361af
commit 298021d25a
6 changed files with 438 additions and 80 deletions

26
static/js/utils.js Normal file
View file

@ -0,0 +1,26 @@
const mapRelay = (obj, oldObj = {}) => {
const relay = {...oldObj, ...obj}
relay.expanded = oldObj.expanded || false
return relay
}
function loadTemplateAsync(path) {
const result = new Promise(resolve => {
const xhttp = new XMLHttpRequest()
xhttp.onreadystatechange = function () {
if (this.readyState == 4) {
if (this.status == 200) resolve(this.responseText)
if (this.status == 404) resolve(`<div>Page not found: ${path}</div>`)
}
}
xhttp.open('GET', path, true)
xhttp.send()
})
return result
}