diff --git a/api/success.ts b/api/success.ts index 9e9e8cf0..ae9e0207 100644 --- a/api/success.ts +++ b/api/success.ts @@ -24,12 +24,14 @@ export default async function handler(req: VercelRequest, res: VercelResponse) { try { + // Require authentication const rawAuthHeader = Array.isArray(req.headers['authorization']) ? req.headers['authorization'][0] : req.headers['authorization']; const authorization = typeof rawAuthHeader === 'string' ? rawAuthHeader : undefined; + if (!authorization) { return res.status(401).json({ error: 'Unauthorized' }); } diff --git a/src/components/EnhancedChatInterface.tsx b/src/components/EnhancedChatInterface.tsx index 7d88650d..ea2c90cf 100644 --- a/src/components/EnhancedChatInterface.tsx +++ b/src/components/EnhancedChatInterface.tsx @@ -9,6 +9,7 @@ import type { Id } from '../../convex/_generated/dataModel'; import { streamAIResponse, generateChatTitleFromMessages } from '@/lib/ai'; import { useAuth } from '@/hooks/useAuth'; import { toast } from 'sonner'; +import { useNavigate } from 'react-router-dom'; // Import extracted components import { ChatSidebar } from './chat/ChatSidebar'; diff --git a/vite.config.ts b/vite.config.ts index 3aa82913..78c7c428 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -81,6 +81,7 @@ export default defineConfig(({ mode }) => { cacheableResponse: { statuses: [0, 200], + headers: { 'Cache-Control': /^(?!.*no-store).*/, },