From 8675f0190e2f33c85be6fb7827ad43df061d4f53 Mon Sep 17 00:00:00 2001 From: dominicjk Date: Thu, 11 Apr 2024 08:12:28 -0600 Subject: [PATCH] update --- ProjectSourceCode/.env | 2 +- ProjectSourceCode/package-lock.json | 9 ++-- ProjectSourceCode/package.json | 2 +- .../js/registry-page/selectFunctions.js | 37 ++++++++++++++++ .../src/resources/js/selectFunctions.js | 40 ------------------ .../src/views/pages/register.hbs | 42 +------------------ 6 files changed, 46 insertions(+), 86 deletions(-) create mode 100644 ProjectSourceCode/src/resources/js/registry-page/selectFunctions.js delete mode 100644 ProjectSourceCode/src/resources/js/selectFunctions.js diff --git a/ProjectSourceCode/.env b/ProjectSourceCode/.env index 4bc6df3..766f95d 100644 --- a/ProjectSourceCode/.env +++ b/ProjectSourceCode/.env @@ -5,4 +5,4 @@ POSTGRES_DB="users_db" # Node vars SESSION_SECRET="super duper secret!" -API_KEY="ZjGXIfaEG1G4OkSHyB5wvqOQ5BPb9iav" \ No newline at end of file +API_KEY="ZjGXIfaEG1G4OkSHyB5wvqOQ5BPb9iav" diff --git a/ProjectSourceCode/package-lock.json b/ProjectSourceCode/package-lock.json index 41b621f..4c9163e 100644 --- a/ProjectSourceCode/package-lock.json +++ b/ProjectSourceCode/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "web-services", "dependencies": { - "axios": "^1.1.3", + "axios": "^1.6.8", "bcrypt": "^5.1.1", "bcryptjs": "^2.4.3", "body-parser": "1.20.0", @@ -165,10 +165,11 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.6.7", - "license": "MIT", + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", "dependencies": { - "follow-redirects": "^1.15.4", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } diff --git a/ProjectSourceCode/package.json b/ProjectSourceCode/package.json index adfe5e3..add9d67 100644 --- a/ProjectSourceCode/package.json +++ b/ProjectSourceCode/package.json @@ -2,7 +2,7 @@ "name": "web-services", "main": "index.js", "dependencies": { - "axios": "^1.1.3", + "axios": "^1.6.8", "bcrypt": "^5.1.1", "bcryptjs": "^2.4.3", "body-parser": "1.20.0", diff --git a/ProjectSourceCode/src/resources/js/registry-page/selectFunctions.js b/ProjectSourceCode/src/resources/js/registry-page/selectFunctions.js new file mode 100644 index 0000000..6397b13 --- /dev/null +++ b/ProjectSourceCode/src/resources/js/registry-page/selectFunctions.js @@ -0,0 +1,37 @@ +const league_select = document.getElementById('league_dropdown'); +const team_select = document.getElementById('team_dropdown'); + +document.addEventListener("DOMContentLoaded", function() { + + league_select.addEventListener('change', updateTeamSelect); + + function updateTeamSelect() { + var selectedLeague = league_select.value; + + team_select.innerHTML = ""; + console.log(selectedLeague); + // Add options based on the selected value from the first select element + if (selectedLeague === "La Liga") { + // Add options for La Liga + console.log("Hello"); + + addOption(team_select, "Option 1 for LL", "option1A"); + addOption(team_select, "Option 2 for LL", "option2A"); + } else if (selectedLeague === "Serie A") { + // Add options for Serie A + addOption(team_select, "Team 1 in Serie A", "option1B"); + addOption(team_select, "Team 2 in Serie A", "option2B"); + } else if (selectedLeague === "Bundesliga") { + // Add options for Bundesliga + addOption(team_select, "Option 1 for Bun", "option1C"); + addOption(team_select, "Option 2 for Bun", "option2C"); + } + } + + function addOption(selectElement, text, value) { + var option = document.createElement("option"); + option.text = text; + option.value = value; + selectElement.add(option); + } +}); \ No newline at end of file diff --git a/ProjectSourceCode/src/resources/js/selectFunctions.js b/ProjectSourceCode/src/resources/js/selectFunctions.js deleted file mode 100644 index 2b9304c..0000000 --- a/ProjectSourceCode/src/resources/js/selectFunctions.js +++ /dev/null @@ -1,40 +0,0 @@ - -document.addEventListener("DOMContentLoaded", function() { - - - const league_select = document.getElementById('league_dropdown'); - const team_select = document.getElementById('team_dropdown'); - - league_select.addEventListener('change', updateTeamSelect); - - function updateTeamSelect() { - var selectedLeague = league_select.value; - var teamSelect = team_select; - - // Clear existing options - teamSelect.innerHTML = ""; - - // Add options based on the selected value from the first select element - if (selectedLeague === "La Liga") { - // Add options for La Liga - addOption(teamSelect, "Option 1 for LL", "option1A"); - addOption(teamSelect, "Option 2 for LL", "option2A"); - } else if (selectedLeague === "Serie A") { - // Add options for Serie A - addOption(teamSelect, "Team 1 in Serie A", "option1B"); - addOption(teamSelect, "Team 2 in Serie A", "option2B"); - } else { - // Add options for Bundesliga - addOption(teamSelect, "Option 1 for Bun", "option1C"); - addOption(teamSelect, "Option 2 for Bun", "option2C"); - } - } - - function addOption(selectElement, text, value) { - var option = document.createElement("option"); - option.text = text; - option.value = value; - selectElement.add(option); - } - }); - \ No newline at end of file diff --git a/ProjectSourceCode/src/views/pages/register.hbs b/ProjectSourceCode/src/views/pages/register.hbs index a591fb7..5b3341e 100644 --- a/ProjectSourceCode/src/views/pages/register.hbs +++ b/ProjectSourceCode/src/views/pages/register.hbs @@ -33,44 +33,6 @@

Already have an account? Login

- + +