mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fix: closes #12780, 404 in api/v3 if topic doesn't exist
This commit is contained in:
@@ -11,7 +11,11 @@ const uploadsController = require('../uploads');
|
|||||||
const Topics = module.exports;
|
const Topics = module.exports;
|
||||||
|
|
||||||
Topics.get = async (req, res) => {
|
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) => {
|
Topics.create = async (req, res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user