debug(web): add logging to changePasswordAction to diagnose Verbindungsfehler
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,10 @@ export async function changePasswordAction(
|
|||||||
const cookieStore = await cookies();
|
const cookieStore = await cookies();
|
||||||
const session = cookieStore.get('session')?.value;
|
const session = cookieStore.get('session')?.value;
|
||||||
|
|
||||||
|
console.log('[changePasswordAction] session present:', !!session, 'API_URL:', API_URL);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
console.error('[changePasswordAction] no session cookie found');
|
||||||
return { success: false, error: 'networkError' };
|
return { success: false, error: 'networkError' };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,8 +123,11 @@ export async function changePasswordAction(
|
|||||||
body: JSON.stringify({ currentPassword, newPassword }),
|
body: JSON.stringify({ currentPassword, newPassword }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('[changePasswordAction] API response status:', response.status);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const data = await response.json().catch(() => null);
|
const data = await response.json().catch(() => null);
|
||||||
|
console.error('[changePasswordAction] API error:', data);
|
||||||
if (data?.message === 'Current password is incorrect') {
|
if (data?.message === 'Current password is incorrect') {
|
||||||
return { success: false, error: 'wrongCurrentPassword' };
|
return { success: false, error: 'wrongCurrentPassword' };
|
||||||
}
|
}
|
||||||
@@ -129,7 +135,8 @@ export async function changePasswordAction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch {
|
} catch (err) {
|
||||||
|
console.error('[changePasswordAction] fetch threw:', err);
|
||||||
return { success: false, error: 'networkError' };
|
return { success: false, error: 'networkError' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user