From 3df846a31bd76e870250053de76db23e86f5ccf5 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Mon, 19 Jan 2026 20:33:09 -0800 Subject: [PATCH] Fix HUD business name - get from listPending API The previous approach called getBusiness which requires auth. Now listPending returns BUSINESS_NAME and HUD uses that. Co-Authored-By: Claude Opus 4.5 --- api/tasks/listPending.cfm | 10 +++++++++- hud/hud.js | 31 +++++++------------------------ 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/api/tasks/listPending.cfm b/api/tasks/listPending.cfm index 861504f..189bbf4 100644 --- a/api/tasks/listPending.cfm +++ b/api/tasks/listPending.cfm @@ -35,6 +35,13 @@ + + + + + @@ -101,7 +108,8 @@ "OK": true, "ERROR": "", "TASKS": tasks, - "COUNT": arrayLen(tasks) + "COUNT": arrayLen(tasks), + "BUSINESS_NAME": businessName })> diff --git a/hud/hud.js b/hud/hud.js index da7b842..643fc97 100644 --- a/hud/hud.js +++ b/hud/hud.js @@ -39,10 +39,7 @@ const HUD = { setInterval(() => this.updateBars(), 1000); setInterval(() => this.fetchTasks(), 3000); - // Fetch business name - this.fetchBusinessName(); - - // Initial fetch + // Initial fetch (also gets business name) this.fetchTasks(); // Close overlay on background tap @@ -64,26 +61,6 @@ const HUD = { document.getElementById('clock').textContent = `${hours}:${minutes}:${seconds}`; }, - // Fetch business name from API - async fetchBusinessName() { - try { - const response = await fetch('/api/setup/getBusiness.cfm', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ BusinessID: this.config.businessId }) - }); - - const data = await response.json(); - - if (data.OK && data.BUSINESS && data.BUSINESS.BusinessName) { - this.businessName = data.BUSINESS.BusinessName; - document.getElementById('businessName').textContent = ' - ' + this.businessName; - } - } catch (err) { - console.error('[HUD] Error fetching business name:', err); - } - }, - // Fetch tasks from API async fetchTasks() { try { @@ -99,6 +76,12 @@ const HUD = { this.tasks = data.TASKS || []; this.renderTasks(); this.setConnected(true); + + // Update business name from response + if (data.BUSINESS_NAME && !this.businessName) { + this.businessName = data.BUSINESS_NAME; + document.getElementById('businessName').textContent = ' - ' + this.businessName; + } } else { console.error('[HUD] API error:', data.ERROR); this.setConnected(false);