You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB
JavaScript

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function loadProfilePage() {
app.preloader.show();
callAPI("getprofile", {
key: localStorage.getItem("key"),
}, function (data) {
$("#name").val(data.profile.name);
$("#bio").val(data.profile.bio);
app.input.resizeTextarea($("#bio"));
app.preloader.hide();
}, function (msg) {
app.preloader.hide();
app.dialog.alert(msg, "Error loading profile");
});
}
function saveProfile() {
app.preloader.show();
callAPI("setprofile", {
key: localStorage.getItem("key"),
name: $("#name").val(),
bio: $("#bio").val()
}, function (data) {
app.preloader.hide();
app.toast.create({
text: "<i class=\"fas fa-check\"></i> Profile updated!",
closeTimeout: 2000
}).open();
}, function (msg) {
app.preloader.hide();
app.dialog.alert(msg, "Error saving profile");
});
}