diff --git a/static/script.js b/static/script.js index 60257fb4..26121a12 100644 --- a/static/script.js +++ b/static/script.js @@ -690,15 +690,15 @@ if (isIndexPage) { // Form submission and API call // ---------------------------------------------------------- - form.addEventListener("submit", function (evt) { - evt.preventDefault(); + form.addEventListener("submit", function (evt) { + evt.preventDefault(); - clearAllErrors(); + clearAllErrors(); - if (skillsTextInput.value.trim()) { - addSkill(skillsTextInput.value); - skillsTextInput.value = ""; - hideSuggestions(); + if (skillsTextInput.value.trim()) { + addSkill(skillsTextInput.value); + skillsTextInput.value = ""; + hideSuggestions(); } if (!validateForm()) return; @@ -733,24 +733,17 @@ if (isIndexPage) { if (generalErr) { generalErr.textContent = data.error; } - return; } - renderResults(data.projects || [], data.message); }) - .catch(function (err) { - + .catch(function () { setLoadingState(false); - var generalErr = document.getElementById("form-error-general"); - if (generalErr) { generalErr.textContent = - "Something went wrong. Please try again."; + "Something went wrong while fetching recommendations."; } - - console.error("API request failed:", err); }); }); }); @@ -830,6 +823,7 @@ if (isIndexPage) { resultsSection.scrollIntoView({ behavior: "smooth" }); } + function buildProjectCard(project) { var card = document.createElement("div"); card.className = "project-card"; @@ -1400,4 +1394,4 @@ updateRoadmapProgress(); handleScroll(); } -})(); \ No newline at end of file +})();