Club routes early prototype in place

This commit is contained in:
Lucas Patenaude
2024-04-14 12:49:37 -06:00
parent a2b47e4b81
commit fdd965f5b0
7 changed files with 52 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ const app = express();
// generate-league-routes.js
// Define a function to generate league routes
module.exports = function generateLeagueRoutes(app) {
module.exports = function generateClubRoutes(app) {
// Define a route to handle requests to "/league/:leagueName"
app.get('/club/:clubID', (req, res) => {
// Extract the league name from the URL parameters

View File

@@ -0,0 +1,16 @@
// Add click event listener to club logos
document.querySelectorAll('.club-logo').forEach(logo => {
logo.addEventListener('click', (event) => {
const clubId = event.target.dataset.team_id;
redirectToClubPage(clubId);
});
});
// Function to redirect to the league page
function redirectToClubPage(clubID) {
// Append the league name to the URL
var url = "/club/" + clubID;
// Redirect to the league page
window.location.href = url;
}

View File

@@ -1,7 +0,0 @@
function redirectToLeaguePage(clubID) {
// Append the league name to the URL
var url = "/club/" + clubID;
// Redirect to the league page
window.location.href = url;
}