feat: add basic UI
This commit is contained in:
parent
5a747361af
commit
298021d25a
6 changed files with 438 additions and 80 deletions
26
static/js/utils.js
Normal file
26
static/js/utils.js
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue