Small refactor for user preferences
This commit is contained in:
parent
1a712fb7a9
commit
81d02b82dc
13 changed files with 202 additions and 112 deletions
32
static/js/page_preferences.mjs
Normal file
32
static/js/page_preferences.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { CustomHTMLElement } from "./lib/custom_html_element.mjs"
|
||||
import { API } from './api.mjs'
|
||||
|
||||
export class N2PagePreferences extends CustomHTMLElement {
|
||||
static {// {{{
|
||||
this.tmpl = document.createElement('template')
|
||||
this.tmpl.innerHTML = `
|
||||
<h1>Preferences</h1>
|
||||
`
|
||||
}// }}}
|
||||
constructor() {// {{{
|
||||
super()
|
||||
window._mbus.subscribe('SHOW_PAGE', event => {
|
||||
if (event.detail.data?.page == 'preferences')
|
||||
this.render()
|
||||
})
|
||||
}// }}}
|
||||
async render() {// {{{
|
||||
}// }}}
|
||||
getPreferences() {
|
||||
API.query('GET', '/user/preferences')
|
||||
}
|
||||
}
|
||||
customElements.define('n2-pagepreferences', N2PagePreferences)
|
||||
|
||||
// Preferences is a set of preferences, of which there can be many named.
|
||||
class Preferences {
|
||||
constructor(name, data) {
|
||||
this.name = name
|
||||
this.data = data
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue