fix api-key edit (thx Davidd), fix dns-editor ttl field (thx Rolf)

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-12-05 20:58:57 +01:00
parent 5b7a76b608
commit 609c15688c
3 changed files with 11 additions and 9 deletions

View File

@@ -5,12 +5,12 @@ $(function () {
var _this = $(this);
clearTimeout(timer);
timer = setTimeout(function () {
var akid = $('div[data-action="apikeys"]').data('entry');
var akid = _this.closest('div[data-action="apikeys"]').data('entry');
$.ajax({
url: "lib/ajax.php?action=editapikey",
type: "POST",
dataType: "json",
data: { id: akid, allowed_from: _this.val(), valid_until: $('div[data-action="apikeys"] #valid_until').val() },
data: { id: akid, allowed_from: _this.val(), valid_until: $('div[data-entry="' + akid + '"] #valid_until').val() },
success: function (data) {
if (data.message) {
_this.removeClass('is-valid');
@@ -22,7 +22,8 @@ $(function () {
}
},
error: function (request, status, error) {
console.log(request, status, error)
_this.removeClass('is-valid');
_this.addClass('is-invalid');
}
});
}, delay);
@@ -32,12 +33,12 @@ $(function () {
var _this = $(this);
clearTimeout(timer);
timer = setTimeout(function () {
var akid = $('div[data-action="apikeys"]').data('entry');
var akid = _this.closest('div[data-action="apikeys"]').data('entry');
$.ajax({
url: "lib/ajax.php?action=editapikey",
type: "POST",
dataType: "json",
data: { id: akid, valid_until: _this.val(), allowed_from: $('div[data-action="apikeys"] #allowed_from').val() },
data: { id: akid, valid_until: _this.val(), allowed_from: $('div[data-entry="' + akid + '"] #allowed_from').val() },
success: function (data) {
if (data.message) {
_this.removeClass('is-valid');
@@ -49,9 +50,11 @@ $(function () {
}
},
error: function (request, status, error) {
console.log(request, status, error)
_this.removeClass('is-valid');
_this.addClass('is-invalid');
}
});
}, delay);
});
});