remove favorite team now working
This commit is contained in:
@@ -295,12 +295,12 @@ app.post('/favteam/add', async (req, res, next) => {
|
||||
});
|
||||
app.post('/favteam/remove', async (req, res) => {
|
||||
try {
|
||||
const { userID, teamName } = req.body;
|
||||
const { userID, teamID } = req.body;
|
||||
|
||||
// Check if the team exists for the user
|
||||
const existingTeam = await db.oneOrNone(
|
||||
'SELECT * FROM FavoriteTeams WHERE UserID = $1 AND TeamName = $2',
|
||||
[userID, teamName]
|
||||
'SELECT * FROM FavoriteTeams WHERE UserID = $1 AND TeamID = $2',
|
||||
[userID, teamID]
|
||||
);
|
||||
|
||||
// If the team does not exist for the user, return a 404 error
|
||||
@@ -310,8 +310,8 @@ app.post('/favteam/remove', async (req, res) => {
|
||||
|
||||
// Remove the favorite team from the database
|
||||
await db.none(
|
||||
'DELETE FROM FavoriteTeams WHERE UserID = $1 AND TeamName = $2',
|
||||
[userID, teamName]
|
||||
'DELETE FROM FavoriteTeams WHERE UserID = $1 AND TeamID = $2',
|
||||
[userID, teamID]
|
||||
);
|
||||
|
||||
console.log('Favorite team removed successfully.');
|
||||
|
||||
Reference in New Issue
Block a user