hf
Browse files
frontend/src/services/apiClient.js
CHANGED
@@ -32,6 +32,16 @@ apiClient.interceptors.request.use(
|
|
32 |
headers: config.headers,
|
33 |
data: config.data
|
34 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
// Get token from cookie service with fallback to localStorage
|
|
|
32 |
headers: config.headers,
|
33 |
data: config.data
|
34 |
});
|
35 |
+
|
36 |
+
// Special logging for auth requests to verify field transformation
|
37 |
+
if (config.url?.includes('/auth/register')) {
|
38 |
+
console.log('π [Auth Register] Request data verification:', {
|
39 |
+
hasConfirmPassword: 'confirmPassword' in (config.data || {}),
|
40 |
+
hasConfirmPassword: 'confirm_password' in (config.data || {}),
|
41 |
+
dataKeys: Object.keys(config.data || {}),
|
42 |
+
fullData: config.data
|
43 |
+
});
|
44 |
+
}
|
45 |
}
|
46 |
|
47 |
// Get token from cookie service with fallback to localStorage
|
frontend/src/services/authService.js
CHANGED
@@ -15,6 +15,16 @@ class AuthService {
|
|
15 |
*/
|
16 |
async register(userData) {
|
17 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
const response = await apiClient.post('/auth/register', userData);
|
19 |
return response;
|
20 |
} catch (error) {
|
|
|
15 |
*/
|
16 |
async register(userData) {
|
17 |
try {
|
18 |
+
// Debug log to verify data before sending
|
19 |
+
if (import.meta.env.VITE_NODE_ENV === 'development') {
|
20 |
+
console.log('π [AuthService] Registration data being sent:', {
|
21 |
+
hasConfirmPassword: 'confirmPassword' in userData,
|
22 |
+
hasConfirmPassword: 'confirm_password' in userData,
|
23 |
+
dataKeys: Object.keys(userData),
|
24 |
+
fullData: userData
|
25 |
+
});
|
26 |
+
}
|
27 |
+
|
28 |
const response = await apiClient.post('/auth/register', userData);
|
29 |
return response;
|
30 |
} catch (error) {
|
frontend/src/store/reducers/authSlice.js
CHANGED
@@ -233,6 +233,14 @@ export const registerUser = createAsyncThunk(
|
|
233 |
confirm_password: userData.confirmPassword // Transform confirmPassword to confirm_password
|
234 |
};
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
const response = await authService.register(transformedData);
|
237 |
return response.data;
|
238 |
} catch (error) {
|
|
|
233 |
confirm_password: userData.confirmPassword // Transform confirmPassword to confirm_password
|
234 |
};
|
235 |
|
236 |
+
// Debug log to verify transformation
|
237 |
+
if (import.meta.env.VITE_NODE_ENV === 'development') {
|
238 |
+
console.log('π [Auth] Transforming registration data:', {
|
239 |
+
original: userData,
|
240 |
+
transformed: transformedData
|
241 |
+
});
|
242 |
+
}
|
243 |
+
|
244 |
const response = await authService.register(transformedData);
|
245 |
return response.data;
|
246 |
} catch (error) {
|