From 2554935875aab2fade3f81c06ac0de7b1d02dcb5 Mon Sep 17 00:00:00 2001 From: sdarbinyan Date: Wed, 13 May 2026 14:47:02 +0400 Subject: [PATCH] status check --- .../pages/fastcheck-page/fastcheck-page.ts | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/app/pages/fastcheck-page/fastcheck-page.ts b/src/app/pages/fastcheck-page/fastcheck-page.ts index 0f415cb..7f05dd5 100644 --- a/src/app/pages/fastcheck-page/fastcheck-page.ts +++ b/src/app/pages/fastcheck-page/fastcheck-page.ts @@ -82,6 +82,8 @@ export class FastcheckPage { // Non-blocking settings hint shown above the form when /settings fails. settingsError = signal(''); settingsLoaded = signal(false); + // True only after /settings returned 200 — used to disable Pay button otherwise. + settingsOk = signal(false); popupOpen = signal(false); popupLoading = signal(false); @@ -148,6 +150,24 @@ export class FastcheckPage { // Always call settings on each load — may return active check data to autofill. this.loadSettings(!!created || !!iidParam); + + // Connectivity check — makes visible requests in DevTools and surfaces + // backend availability issues early. + this.pingBackends(); + } + + /** Fire GET /ping on both backends and log status. Non-blocking. */ + private pingBackends(): void { + const targets = [ + { name: 'fastcheck', url: `${FASTCHECK_API}/ping` }, + { name: 'qr-vitanova', url: `${QR_VITANOVA_API}/ping` } + ]; + for (const t of targets) { + this.http.get(t.url, { observe: 'response' }).subscribe({ + next: (res) => console.debug(`[ping:${t.name}]`, res.status, t.url), + error: (err) => console.warn(`[ping:${t.name}] failed`, err?.status ?? err, t.url) + }); + } } /** @@ -162,6 +182,7 @@ export class FastcheckPage { if (!id) { this.settingsError.set(this.t('errors.settings_missing_id')); this.settingsLoaded.set(true); + this.settingsOk.set(false); return; } @@ -170,11 +191,13 @@ export class FastcheckPage { next: (res) => { this.settingsLoaded.set(true); this.settingsError.set(''); + this.settingsOk.set(true); this.applySettings(res ?? {}, alreadyAutofilled); }, error: () => { - // Non-blocking: keep manual mode available. + // Non-blocking: keep manual mode available, but Pay stays disabled. this.settingsLoaded.set(true); + this.settingsOk.set(false); this.settingsError.set(this.t('errors.settings_failed')); } });