Enhance official tournament listing and upload functionality
This commit updates the `listOfficialTournaments` function to ensure it returns an empty array if no tournaments are found, improving data handling. Additionally, the frontend `OfficialTournaments.vue` is enhanced with a file upload feature for PDF documents, along with improved error handling in the tournament list loading process. These changes enhance user experience by providing clearer feedback and functionality for managing official tournaments.
This commit is contained in:
@@ -233,9 +233,11 @@ export const listOfficialTournaments = async (req, res) => {
|
||||
const { clubId } = req.params;
|
||||
await checkAccess(userToken, clubId);
|
||||
const list = await OfficialTournament.findAll({ where: { clubId } });
|
||||
res.status(200).json(list);
|
||||
res.status(200).json(Array.isArray(list) ? list : []);
|
||||
} catch (e) {
|
||||
res.status(500).json({ error: 'Failed to list tournaments' });
|
||||
console.error('[listOfficialTournaments] Error:', e);
|
||||
const errorMessage = e.message || 'Failed to list tournaments';
|
||||
res.status(e.statusCode || 500).json({ error: errorMessage });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user