add a check if json variable exists or not

Signed-off-by: Ashley <iamashley@duck.com>
This commit is contained in:
Ashley 2022-12-24 11:30:00 +00:00
parent 53fcc21fab
commit 779e85441f

View file

@ -119,6 +119,10 @@ module.exports = function (app, config, renderTemplate) {
let url; let url;
if (j_.URL != undefined) url = j_.URL; if (j_.URL != undefined) url = j_.URL;
//checks if json exists
if (json) {
//checks if title exists in the json object
if ("Title" in json) { if ("Title" in json) {
// json response // json response
const re = { const re = {
@ -136,6 +140,7 @@ module.exports = function (app, config, renderTemplate) {
res.json(re); res.json(re);
} }
}
}); });
app.get("/watch", async function (req, res) { app.get("/watch", async function (req, res) {