From 9940c2037923474e2e50b9b322a3c90cdbafaccb Mon Sep 17 00:00:00 2001 From: lorentz Date: Tue, 3 Feb 2026 09:20:50 -0500 Subject: [PATCH] fix: parse excluded_classifications as array and handle companies API response - Fixed settings API to parse excluded_classifications as array - Fixed companies API response handling (returns {companies: []} not array) - Resolves TypeError: excluded_classifications.filter is not a function - Resolves TypeError: s.sort is not a function --- app/api/kiosk/settings/route.ts | 4 ++-- app/kiosk/settings/page.tsx | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/api/kiosk/settings/route.ts b/app/api/kiosk/settings/route.ts index f4ba6f8..2bde27f 100644 --- a/app/api/kiosk/settings/route.ts +++ b/app/api/kiosk/settings/route.ts @@ -12,8 +12,8 @@ export async function GET(request: NextRequest) { let value = row.setting_value; // Parse specific settings - if (row.setting_key === 'excluded_company_ids') { - value = value ? value.split(',').map((id: string) => id.trim()).filter(Boolean) : []; + if (row.setting_key === 'excluded_company_ids' || row.setting_key === 'excluded_classifications') { + value = value ? value.split(',').map((item: string) => item.trim()).filter(Boolean) : []; } else if (row.setting_key === 'show_rmm_alerts') { value = value === 'true'; } else if (['cycle_interval', 'refresh_interval'].includes(row.setting_key)) { diff --git a/app/kiosk/settings/page.tsx b/app/kiosk/settings/page.tsx index ddc84e6..156ddd1 100644 --- a/app/kiosk/settings/page.tsx +++ b/app/kiosk/settings/page.tsx @@ -62,7 +62,9 @@ export default function KioskSettingsPage() { const res = await fetch('/api/companies'); if (res.ok) { const data = await res.json(); - setCompanies(data.sort((a: Company, b: Company) => + // API returns { companies: [...] } + const companiesList = data.companies || []; + setCompanies(companiesList.sort((a: Company, b: Company) => a.companyName.localeCompare(b.companyName) )); }