fix: Add missing COPPA fields to registration payload
- Added dateOfBirth, parentalEmail, and coppaConsentGiven to RegisterData interface - Updated register function to include all required COPPA compliance fields in API payload - Added debug logging to see registration payload - Fixed 400 error during registration due to missing required dateOfBirth field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,9 @@ export interface RegisterData {
|
||||
password: string;
|
||||
name: string;
|
||||
role?: string;
|
||||
dateOfBirth: string; // COPPA compliance - required
|
||||
parentalEmail?: string; // For users 13-17
|
||||
coppaConsentGiven?: boolean; // For users 13-17
|
||||
}
|
||||
|
||||
interface AuthContextType {
|
||||
@@ -144,13 +147,26 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
|
||||
// Auto-detect timezone from user's device
|
||||
const detectedTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
|
||||
const response = await apiClient.post('/api/v1/auth/register', {
|
||||
const payload: any = {
|
||||
email: data.email,
|
||||
password: data.password,
|
||||
name: data.name,
|
||||
timezone: detectedTimezone || 'UTC',
|
||||
dateOfBirth: data.dateOfBirth,
|
||||
deviceInfo,
|
||||
});
|
||||
};
|
||||
|
||||
// Add optional COPPA fields if provided
|
||||
if (data.parentalEmail) {
|
||||
payload.parentalEmail = data.parentalEmail;
|
||||
}
|
||||
if (data.coppaConsentGiven !== undefined) {
|
||||
payload.coppaConsentGiven = data.coppaConsentGiven;
|
||||
}
|
||||
|
||||
console.log('[Auth] Registration payload:', JSON.stringify(payload, null, 2));
|
||||
|
||||
const response = await apiClient.post('/api/v1/auth/register', payload);
|
||||
|
||||
// Backend returns { success, data: { user, family, tokens } }
|
||||
const { data: responseData } = response.data;
|
||||
|
||||
Reference in New Issue
Block a user