From 54c658ff9bfb9fafade5850ef1ef2131d05580c1 Mon Sep 17 00:00:00 2001 From: CosmosDev Date: Thu, 15 Dec 2022 20:28:06 +0100 Subject: [PATCH] Clean code --- inc/teddit_api/handlePost.js | 1 - inc/teddit_api/handleSubreddit.js | 6 +----- routes/subreddit.js | 4 ---- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/inc/teddit_api/handlePost.js b/inc/teddit_api/handlePost.js index 5fc3444..b5877e4 100644 --- a/inc/teddit_api/handlePost.js +++ b/inc/teddit_api/handlePost.js @@ -19,7 +19,6 @@ module.exports = function () { } console.log('Teddit API request - post'); - let _json = json; // Keep the original json if (from === 'redis') json = JSON.parse(json); if (api_type === 'rss') { diff --git a/inc/teddit_api/handleSubreddit.js b/inc/teddit_api/handleSubreddit.js index 1430a90..d98c241 100644 --- a/inc/teddit_api/handleSubreddit.js +++ b/inc/teddit_api/handleSubreddit.js @@ -77,10 +77,8 @@ module.exports = function () { }; this.handleTedditApiSubredditAbout = async ( json, - req, res, from, - api_type, api_target ) => { if (!config.api_enabled) { @@ -92,7 +90,6 @@ module.exports = function () { } console.log('Teddit API request - subreddit about'); - let _json = json; // Keep the original json if (from === 'redis') json = JSON.parse(json); res.setHeader('Content-Type', 'application/json'); @@ -128,7 +125,6 @@ module.exports = function () { } console.log('Teddit API request - subreddit search'); - let _json = json; // Keep the original json if (from === 'redis') json = JSON.parse(json); if (api_type === 'rss') { @@ -147,7 +143,7 @@ module.exports = function () { let xml_output = ` - + ${title} ${link} Results for: ${query} - ${r_subreddit} diff --git a/routes/subreddit.js b/routes/subreddit.js index 046f39e..441d570 100644 --- a/routes/subreddit.js +++ b/routes/subreddit.js @@ -250,10 +250,8 @@ subredditRoutes.get('/r/:subreddit/about', (req, res, next) => { (async () => { return handleTedditApiSubredditAbout( json, - req, res, 'redis', - api_type, api_target ); })(); @@ -289,10 +287,8 @@ subredditRoutes.get('/r/:subreddit/about', (req, res, next) => { (async () => { return handleTedditApiSubredditAbout( json, - req, res, 'from_online', - api_type, api_target ); })();