+22
-1
@@ -246,6 +246,27 @@
|
||||
$('#menuToggle').attr('aria-expanded', 'false');
|
||||
});
|
||||
|
||||
function checkApiLive() {
|
||||
var $statusEl = $('#api-status');
|
||||
return $.ajax({
|
||||
url: '/api/health/live',
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
timeout: 5000
|
||||
}).done(function (data) {
|
||||
var status = (data && data.status) ? data.status : 'unknown';
|
||||
if ($statusEl.length) {
|
||||
$statusEl.text('API: ' + status).removeClass('text-danger').addClass('text-success');
|
||||
} else {
|
||||
console.log('API live status:', status);
|
||||
}
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
if ($statusEl.length) {
|
||||
$statusEl.text('API: offline').removeClass('text-success').addClass('text-danger');
|
||||
}
|
||||
console.error('API health check failed:', textStatus, errorThrown);
|
||||
});
|
||||
}
|
||||
function getRecaptchaWebKey() {
|
||||
return $.get('/api/contact').done(function (res) {
|
||||
reCaptchaSiteKey = res;
|
||||
@@ -494,6 +515,6 @@
|
||||
});
|
||||
}
|
||||
$(window).on('load', function () {
|
||||
$.when(getRecaptchaWebKey(), getGoogleTagManagerId()).always(initConsent);
|
||||
$.when(checkApiLive(), getRecaptchaWebKey(), getGoogleTagManagerId()).always(initConsent);
|
||||
});
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user