From 661bf461f992d2f8c170cefec47e63429c917a10 Mon Sep 17 00:00:00 2001 From: Gelu Mihes Date: Mon, 4 May 2026 21:46:37 +0300 Subject: [PATCH] Changes --- web/wwwroot/js/myai.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/web/wwwroot/js/myai.js b/web/wwwroot/js/myai.js index b182d7d..3e85b62 100644 --- a/web/wwwroot/js/myai.js +++ b/web/wwwroot/js/myai.js @@ -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); \ No newline at end of file