forked from lucaspatenaude/ScoreSpot
Top scorer data imported into league page
This commit is contained in:
@@ -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
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user