diff --git a/index.html b/index.html index 54b614c..b9a2032 100644 --- a/index.html +++ b/index.html @@ -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') {