edit server side code error message for wrong user input

This commit is contained in:
Ryan Mwangi 2024-10-21 15:33:57 +03:00
parent fe446b1b09
commit f5f23d85e0
1 changed files with 2 additions and 2 deletions

View File

@ -30,8 +30,8 @@ app.post('/merge', async (req, res) => {
try {
// Validate the input
if (!linkGroupName || !calendars || !Array.isArray(calendars)) {
return res.status(400).json({ error: 'Invalid input' });
if (!linkGroupName || !calendars || !Array.isArray(calendars) || calendars.length === 0) {
return res.status(400).json({ error: 'Invalid input. Please provide a linkGroupName and at least one calendar.' });
}
// Generate a unique identifier for this set of calendars
const calendarId = crypto.randomBytes(16).toString('hex');