From da8b08cd7364bf2c55135e80ba95e69afb7e8ce1 Mon Sep 17 00:00:00 2001 From: Maulana Sodiqin Date: Wed, 10 Dec 2025 22:01:37 +0700 Subject: [PATCH] fix: allow unauthenticated users to view certificates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated API error interceptor to skip redirect on certificate pages - Prevents 401 errors from redirecting to login on public certificate pages - Certificate pages can now be viewed without authentication 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- libs/service/src/api/hackathon.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/service/src/api/hackathon.ts b/libs/service/src/api/hackathon.ts index 29a2cfa..4b2eb43 100644 --- a/libs/service/src/api/hackathon.ts +++ b/libs/service/src/api/hackathon.ts @@ -31,12 +31,13 @@ hackathonApi.interceptors.response.use( (response) => response, (error) => { // Handle 401 - clear session and redirect to login - // But skip redirect if already on auth pages (to avoid reload on login failure) + // But skip redirect if already on auth pages or certificate pages (to avoid reload on login failure) if (error.response?.status === 401) { const isAuthPage = globalThis.window !== undefined && globalThis.location.pathname.startsWith('/auth'); + const isCertificatePage = globalThis.window !== undefined && globalThis.location.pathname.startsWith('/certificate/'); - // Only clear session and redirect if not on auth page - if (!isAuthPage) { + // Only clear session and redirect if not on auth page or certificate page + if (!isAuthPage && !isCertificatePage) { useAuthStore.getState().clearSession(); if (globalThis.window !== undefined) { globalThis.location.href = '/auth/login';