mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-14 17:18:32 -05:00
RCon error handling is clearer
Show chat on mobile view of server overview basic authentication switched to extreme-ip-lookup for ip lookups (SSL)
This commit is contained in:
46
WebfrontCore/wwwroot/js/global.js
Normal file
46
WebfrontCore/wwwroot/js/global.js
Normal file
@ -0,0 +1,46 @@
|
||||
$(document).ready(function () {
|
||||
/*
|
||||
* handle action modal
|
||||
*/
|
||||
$('.profile-action').click(function (e) {
|
||||
const actionType = $(this).data('action');
|
||||
$.get('/Action/' + actionType + 'Form')
|
||||
.done(function (response) {
|
||||
$('#actionModal .modal-body').html(response);
|
||||
$('#actionModal').modal();
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
$('#actionModal .modal-body').html('<span class="text-danger">' + error + '</span>');
|
||||
$('#actionModal').modal();
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* handle action submit
|
||||
*/
|
||||
$(document).on('submit', '.action-form', function (e) {
|
||||
e.preventDefault();
|
||||
$(this).append($('#target_id input'));
|
||||
const data = $(this).serialize();
|
||||
$.get($(this).attr('action') + '/?' + data)
|
||||
.done(function (response) {
|
||||
// success without content
|
||||
if (response.length === 0) {
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
$('#actionModal .modal-body').html(response);
|
||||
$('#actionModal').modal();
|
||||
}
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
if (jqxhr.status == 401) {
|
||||
$('#actionModal .modal-body').removeClass('text-danger');
|
||||
$('#actionModal .modal-body').prepend('<div class="text-danger mb-3">Invalid login credentials</div>');
|
||||
}
|
||||
else {
|
||||
$('#actionModal .modal-body').html('<span class="text-danger">Error — ' + error + '</span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user