Fix WebSocket authentication and duplicate filters
- Remove mock authentication from authSlice to enable real user login - Fix WebSocket connection errors by using real JWT tokens - Consolidate duplicate filters on insights page into single shared filter - Update InsightsDashboard to accept props instead of managing own state - Add MUI Grid styling for 20% min-width and centering - Improve UX with unified filter controls for both insights and predictions
This commit is contained in:
@@ -15,27 +15,10 @@ export interface AuthState {
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
// Mock user and token for development (TODO: Remove in production and implement real auth)
|
||||
const MOCK_USER: User = {
|
||||
id: 'user_test123',
|
||||
email: 'test@maternal.app',
|
||||
name: 'Test User',
|
||||
familyId: 'fam_test123',
|
||||
};
|
||||
|
||||
// Mock JWT token for development - this is just for testing, real auth needed in production
|
||||
const MOCK_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c2VyX3Rlc3QxMjMiLCJmYW1pbHlJZCI6ImZhbV90ZXN0MTIzIiwiaWF0IjoxNjAwMDAwMDAwfQ.mock_signature_for_development';
|
||||
|
||||
// Set mock token in localStorage for development
|
||||
if (typeof window !== 'undefined' && process.env.NODE_ENV === 'development') {
|
||||
localStorage.setItem('accessToken', MOCK_TOKEN);
|
||||
}
|
||||
|
||||
const initialState: AuthState = {
|
||||
// Use mock user in development if no real user is stored
|
||||
user: process.env.NODE_ENV === 'development' ? MOCK_USER : null,
|
||||
token: process.env.NODE_ENV === 'development' ? MOCK_TOKEN : null,
|
||||
isAuthenticated: process.env.NODE_ENV === 'development',
|
||||
user: null,
|
||||
token: null,
|
||||
isAuthenticated: false,
|
||||
loading: false,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user