Fix: Add clearAllSurveys function that was missing
This commit is contained in:
+21
@@ -1567,7 +1567,28 @@ function confirmClearAll() {
|
||||
}
|
||||
}
|
||||
|
||||
async function clearAllSurveys() {
|
||||
try {
|
||||
const response = await fetch('/api/surveys', {
|
||||
method: 'DELETE'
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
showNotification('All surveys deleted successfully', 'success');
|
||||
loadSurveys();
|
||||
currentSurveyId = null;
|
||||
currentSurvey = null;
|
||||
document.getElementById('takeSurveyTab').style.display = 'none';
|
||||
document.getElementById('analyzeTab').style.display = 'none';
|
||||
} else {
|
||||
showNotification(data.error || 'Failed to clear surveys', 'error');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error clearing surveys:', e);
|
||||
showNotification('Failed to clear surveys', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// Notification helper
|
||||
function showNotification(message, type = 'info') {
|
||||
|
||||
Reference in New Issue
Block a user