fix: closes #12780, 404 in api/v3 if topic doesn't exist

This commit is contained in:
Barış Soner Uşaklı
2024-09-07 21:31:08 -04:00
parent c0b30ea4ef
commit 220af7068a

View File

@@ -11,7 +11,11 @@ const uploadsController = require('../uploads');
const Topics = module.exports;
Topics.get = async (req, res) => {
helpers.formatApiResponse(200, res, await api.topics.get(req, req.params));
const topicData = await api.topics.get(req, req.params);
if (!topicData) {
return helpers.formatApiResponse(404, res, new Error('[[error:no-topic]]'));
}
helpers.formatApiResponse(200, res, topicData);
};
Topics.create = async (req, res) => {