Fixed issue with /hide api endpoint
This commit is contained in:
@@ -14,7 +14,7 @@ router.get('/hidden', (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hide a channel or group
|
// Hide a channel, group, or category
|
||||||
router.post('/hide', (req, res) => {
|
router.post('/hide', (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { sourceId, itemType, itemId } = req.body;
|
const { sourceId, itemType, itemId } = req.body;
|
||||||
@@ -23,8 +23,9 @@ router.post('/hide', (req, res) => {
|
|||||||
return res.status(400).json({ error: 'sourceId, itemType, and itemId are required' });
|
return res.status(400).json({ error: 'sourceId, itemType, and itemId are required' });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!['channel', 'group'].includes(itemType)) {
|
const validTypes = ['channel', 'group', 'vod_category', 'series_category'];
|
||||||
return res.status(400).json({ error: 'itemType must be "channel" or "group"' });
|
if (!validTypes.includes(itemType)) {
|
||||||
|
return res.status(400).json({ error: `itemType must be one of: ${validTypes.join(', ')}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
hiddenItems.hide(sourceId, itemType, itemId);
|
hiddenItems.hide(sourceId, itemType, itemId);
|
||||||
|
|||||||
Reference in New Issue
Block a user