mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
191 files reformatted across views, components, widgets, hybrid, contexts. New components: CCreateSchemaDialog, CAddFieldDialog, CAdminContentPanel. JS helpers: connBadgeStatus/Text, adminStats, exampleLabels, onLevelClicked. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
1013 B
JavaScript
37 lines
1013 B
JavaScript
.pragma library
|
|
|
|
// DBAL persistence helpers for profile view.
|
|
|
|
function loadProfile(dbal, currentUser, callback) {
|
|
if (!currentUser) return
|
|
dbal.read("user", currentUser, function(result, error) {
|
|
if (result) callback(result)
|
|
})
|
|
}
|
|
|
|
function saveProfile(dbal, currentUser, data, callback) {
|
|
dbal.update("user", currentUser, data, function(result, error) {
|
|
callback(!!result, error)
|
|
})
|
|
}
|
|
|
|
function changePassword(dbal, currentUser, passwords, callback) {
|
|
if (passwords["new"] !== passwords["confirm"]) return
|
|
dbal.execute("core/change-password", {
|
|
userId: currentUser,
|
|
oldPassword: passwords["current"],
|
|
newPassword: passwords["new"]
|
|
}, function(result, error) {
|
|
callback(!!result, error)
|
|
})
|
|
}
|
|
|
|
function loadJson(relativePath) {
|
|
var xhr = new XMLHttpRequest()
|
|
xhr.open("GET", relativePath, false)
|
|
xhr.send()
|
|
if (xhr.status === 200 ||
|
|
xhr.status === 0) return JSON.parse(xhr.responseText)
|
|
return null
|
|
}
|