Top scorer data imported into league page

This commit is contained in:
Lucas Patenaude
2024-04-13 19:39:36 -06:00
parent e3f2588cd3
commit 9b99d8f745
3 changed files with 32 additions and 11 deletions

View File

@@ -17,7 +17,7 @@ const fetchLeagueScorerData = async (req, res, next) => {
const scorerData = response.data;
// Attach the data to res.locals
res.locals.scorers = {
res.locals.topScorers = {
scorers: scorerData.scorers.map(player => ({
player: {
player_id: player.player.id,
@@ -36,7 +36,7 @@ const fetchLeagueScorerData = async (req, res, next) => {
next();
} catch (error) {
console.error('Error fetching leagues data:', error);
res.locals.scorers = null; // Set to null if there's an error
res.locals.topScorers = null; // Set to null if there's an error
next(); // Call next middleware or route handler
}
};