Problem: - Floating chat had its own separate authentication check using localStorage - iOS Safari has restrictions on localStorage access, especially with tracking prevention - This caused logged-in users to still see login prompt in AI chat Solution: - Replace local auth state management with global useAuth hook from AuthProvider - Remove redundant checkAuthStatus() function - Update all authentication checks to use isAuthenticated from useAuth - Update token retrieval to get directly from localStorage only when needed Benefits: - Single source of truth for authentication across the app - More reliable authentication state management - Better compatibility with iOS Safari's privacy features - Automatic auth state synchronization when user logs in/out Changes: - Use useAuth hook instead of local isAuthenticated/authToken state - Remove checkAuthStatus() function - Update loadConversations to read token from localStorage directly - Update loadConversation to read token from localStorage directly - Update handleSendMessage to read token from localStorage directly - Simplify handleAuthSuccess to rely on global auth state updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
39 KiB
39 KiB