debug: Add console.log to diagnose accept changes flow
This commit is contained in:
parent
dcc2e470ec
commit
d40b4b3c3e
@ -843,6 +843,7 @@ function acceptChanges() {
|
||||
|
||||
async function doAcceptChanges() {
|
||||
showLoading();
|
||||
console.log('doAcceptChanges called, appId:', appId);
|
||||
|
||||
try {
|
||||
const response = await fetch(`/membership/review-changes/${appId}/accept`, {
|
||||
@ -853,20 +854,38 @@ async function doAcceptChanges() {
|
||||
}
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
console.log('Response status:', response.status);
|
||||
console.log('Response ok:', response.ok);
|
||||
|
||||
const text = await response.text();
|
||||
console.log('Response text:', text);
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(text);
|
||||
} catch (parseError) {
|
||||
console.error('JSON parse error:', parseError);
|
||||
hideLoading();
|
||||
showNotification('Błąd parsowania odpowiedzi serwera', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Parsed data:', data);
|
||||
hideLoading();
|
||||
|
||||
if (data.success) {
|
||||
console.log('Success! Calling showSuccessScreen...');
|
||||
showSuccessScreen(
|
||||
'accept',
|
||||
'Zmiany zaakceptowane!',
|
||||
'Twoja deklaracja wróciła do rozpatrzenia przez administratora. Otrzymasz powiadomienie o decyzji.'
|
||||
);
|
||||
} else {
|
||||
console.log('Server returned error:', data.error);
|
||||
showNotification(data.error || 'Wystąpił błąd', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
console.error('Fetch error:', error);
|
||||
hideLoading();
|
||||
showNotification('Wystąpił błąd połączenia. Spróbuj ponownie.', 'error');
|
||||
}
|
||||
@ -916,11 +935,24 @@ async function doRejectChanges() {
|
||||
}
|
||||
|
||||
function showSuccessScreen(type, title, message) {
|
||||
console.log('showSuccessScreen called with:', type, title, message);
|
||||
|
||||
const overlay = document.getElementById('successOverlay');
|
||||
const icon = document.getElementById('successIcon');
|
||||
const titleEl = document.getElementById('successTitle');
|
||||
const messageEl = document.getElementById('successMessage');
|
||||
|
||||
console.log('Elements found - overlay:', !!overlay, 'icon:', !!icon, 'title:', !!titleEl, 'message:', !!messageEl);
|
||||
|
||||
if (!overlay) {
|
||||
console.error('CRITICAL: successOverlay element not found!');
|
||||
showNotification('Zmiany zapisane pomyślnie! Przekierowuję...', 'success');
|
||||
setTimeout(() => {
|
||||
window.location.href = '{{ url_for("membership.status") }}';
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
|
||||
titleEl.textContent = title;
|
||||
messageEl.textContent = message;
|
||||
|
||||
@ -932,7 +964,9 @@ function showSuccessScreen(type, title, message) {
|
||||
icon.innerHTML = '<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 8v4"/><path d="M12 16h.01"/></svg>';
|
||||
}
|
||||
|
||||
console.log('Adding show class to overlay');
|
||||
overlay.classList.add('show');
|
||||
console.log('Overlay classes now:', overlay.className);
|
||||
}
|
||||
|
||||
// Zamknij modal klikając poza nim
|
||||
|
||||
Loading…
Reference in New Issue
Block a user