forked from lucaspatenaude/ScoreSpot
Club routes early prototype in place
This commit is contained in:
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user