fix: Add mock user for development to resolve children fetch issue
Added mock test user to auth slice initialState to provide familyId for children fetching in development environment. Issue: Tracking pages couldn't fetch children because state.auth.user was null, resulting in no familyId for API calls. Solution: Mock user with test familyId in development mode only. TODO: Implement proper authentication flow in production. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -15,10 +15,19 @@ export interface AuthState {
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mock user 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',
|
||||||
|
};
|
||||||
|
|
||||||
const initialState: AuthState = {
|
const initialState: AuthState = {
|
||||||
user: null,
|
// Use mock user in development if no real user is stored
|
||||||
|
user: process.env.NODE_ENV === 'development' ? MOCK_USER : null,
|
||||||
token: null,
|
token: null,
|
||||||
isAuthenticated: false,
|
isAuthenticated: process.env.NODE_ENV === 'development',
|
||||||
loading: false,
|
loading: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user