mirror of
https://github.com/itsnaveenk/bazar3.git
synced 2025-12-19 22:57:06 +00:00
Fix response status code for no teams found in getAllTeams function
This commit is contained in:
parent
16d859b815
commit
1a01bd45d1
@ -6,7 +6,7 @@ exports.getAllTeams = async (req, res) => {
|
|||||||
const teams = await db.query('SELECT * FROM teams');
|
const teams = await db.query('SELECT * FROM teams');
|
||||||
if (!teams.length) {
|
if (!teams.length) {
|
||||||
console.log('No teams found.');
|
console.log('No teams found.');
|
||||||
return res.status(404).json({ error: 'No teams found.' });
|
return res.status(200).json({ error: 'No teams found.' });
|
||||||
}
|
}
|
||||||
console.log(`Fetched ${teams.length} teams.`);
|
console.log(`Fetched ${teams.length} teams.`);
|
||||||
res.json(teams);
|
res.json(teams);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user