From 9aaf77146943a6cf1f9525832179c992bc9b6a29 Mon Sep 17 00:00:00 2001 From: Patrick Plate Date: Sat, 13 Jun 2026 17:30:19 +0200 Subject: [PATCH] fix: consent banner fails open on API error (500/403) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The consent check endpoint (/consent/check) returns 500 via the proxy when the backend returns 403 (missing JWT forwarding). Previously this caused the banner to show permanently since consentCheck was undefined. Now isError = true hides the banner (fail-open strategy — don't block users when backend is unavailable). --- cannamanage-frontend/src/components/consent-banner.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cannamanage-frontend/src/components/consent-banner.tsx b/cannamanage-frontend/src/components/consent-banner.tsx index 2455bb9..99ce7cb 100644 --- a/cannamanage-frontend/src/components/consent-banner.tsx +++ b/cannamanage-frontend/src/components/consent-banner.tsx @@ -19,12 +19,12 @@ export function ConsentBanner() { const t = useTranslations("consent") const [marketingChecked, setMarketingChecked] = useState(false) - const { data: consentCheck, isLoading } = useConsentCheckQuery() + const { data: consentCheck, isLoading, isError } = useConsentCheckQuery() const grantMutation = useGrantConsentMutation() const deleteMutation = useDeleteAccountMutation() - // Don't show if still loading or consent already granted - if (isLoading || consentCheck?.hasDataProcessingConsent) { + // Don't show if loading, errored (fail open), or consent already granted + if (isLoading || isError || consentCheck?.hasDataProcessingConsent) { return null }