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:
2025-10-05 06:35:44 +00:00
parent fb92160322
commit cb22d92796
2 changed files with 12 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@@ -15,10 +15,19 @@ export interface AuthState {
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 = {
user: null,
// Use mock user in development if no real user is stored
user: process.env.NODE_ENV === 'development' ? MOCK_USER : null,
token: null,
isAuthenticated: false,
isAuthenticated: process.env.NODE_ENV === 'development',
loading: false,
};