fix: Comprehensive authentication and UI fixes
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

Authentication & Token Management:
- Add deviceId to token refresh flow (backend requires both refreshToken and deviceId)
- Fix React Strict Mode token clearing race condition with retry logic
- Improve AuthContext to handle all token state combinations properly
- Store deviceId in localStorage alongside tokens

UI/UX Improvements:
- Remove deprecated legacyBehavior from Next.js Link components
- Update primary theme color to WCAG AA compliant #7c3aed
- Fix nested button error in TabBar voice navigation
- Fix invalid Tabs value error in DynamicChildDashboard

Multi-Child Dashboard:
- Load all children into Redux store properly
- Fetch metrics for all children, not just selected one
- Remove mock data to prevent unauthorized API calls

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-05 16:10:11 +00:00
parent ee6b5cddee
commit d0b78181a3
11 changed files with 272 additions and 124 deletions

View File

@@ -61,12 +61,44 @@ export const tokenStorage = {
}
},
/**
* Get device ID from storage
*/
getDeviceId: (): string | null => {
if (typeof window === 'undefined') {
return null;
}
try {
return localStorage.getItem('deviceId');
} catch (error) {
console.error('Error reading deviceId:', error);
return null;
}
},
/**
* Set device ID in storage
*/
setDeviceId: (deviceId: string): void => {
if (typeof window === 'undefined') {
return;
}
try {
localStorage.setItem('deviceId', deviceId);
} catch (error) {
console.error('Error setting deviceId:', error);
}
},
/**
* Set both tokens at once
*/
setTokens: (accessToken: string, refreshToken: string): void => {
setTokens: (accessToken: string, refreshToken: string, deviceId?: string): void => {
tokenStorage.setAccessToken(accessToken);
tokenStorage.setRefreshToken(refreshToken);
if (deviceId) {
tokenStorage.setDeviceId(deviceId);
}
},
/**
@@ -79,6 +111,7 @@ export const tokenStorage = {
try {
localStorage.removeItem('accessToken');
localStorage.removeItem('refreshToken');
localStorage.removeItem('deviceId');
} catch (error) {
console.error('Error clearing tokens:', error);
}