fixes eslint errors

This commit is contained in:
Cassidy 2020-04-11 14:40:00 +07:00
parent f2833d4a8e
commit 7797f1f42c
4 changed files with 19 additions and 27 deletions

View file

@ -85,7 +85,6 @@ function syncWithApi(data) { // eslint-disable-line no-unused-vars
console.info(data); // eslint-disable-line no-console
document.querySelector("developer-program").innerHTML =
"<p><strong>No success or error was received so the LBRY API might be down.<br/>Please try again later.</strong></p>";
return;
}
})
.catch(error => {

View file

@ -105,7 +105,7 @@ export default async(data, socket) => {
// P U B L I S H
// E X A M P L E
case "publish":
case "publish":
apiRequestMethod = "PUT";
// Required for publishing
@ -200,7 +200,7 @@ export default async(data, socket) => {
apiRequestMethod = "GET";
body.uri = claimAddress;
try {
let resolveResponse = await lbrytvAPI.resolve([claimAddress]);
const resolveResponse = await lbrytvAPI.resolve([claimAddress]);
if (socket) {
const renderedCode = prism.highlight(

View file

@ -1,20 +1,16 @@
"use strict";
import messageSlack from "./slack";
const request = require("request");
import messageSlack from "./slack";
let addSupport = function() {
return;
};
const addSupport = function() {};
let publish = function() {
return;
};
const publish = function() {};
let resolve = function(urls) {
const resolve = function(urls) {
return new Promise(function(resolve, reject) {
let options = {
const options = {
method: "POST",
url: "https://api.lbry.tv/api/v1/proxy",
headers:
@ -34,7 +30,7 @@ let resolve = function(urls) {
message: "```" + error + "```",
title: "DAEMON ERROR: resolve"
});
return reject("DAEMON ERROR: resolve");
return reject(new Error("DAEMON ERROR: resolve"));
}
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) {
@ -42,17 +38,16 @@ let resolve = function(urls) {
message: "```" + daemonResponse.error + "```",
title: "DAEMON ERROR: resolve"
});
return reject("DAEMON ERROR: resolve");
return reject(new Error("DAEMON ERROR: resolve"));
} else
return resolve(daemonResponse.result);
});
});
};
let getTrending = function() {
const getTrending = function() {
return new Promise(function(resolve, reject) {
let options = {
const options = {
method: "POST",
url: "https://api.lbry.tv/api/v1/proxy",
headers:
@ -95,7 +90,7 @@ let getTrending = function() {
message: "```" + error + "```",
title: "DAEMON ERROR: trending"
});
return reject("DAEMON ERROR: trending");
return reject(new Error("DAEMON ERROR: trending"));
}
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) {
@ -106,8 +101,6 @@ let getTrending = function() {
return reject(JSON.stringify(daemonResponse));
} else
return resolve(daemonResponse.result.items);
});
});
};

View file

@ -123,16 +123,16 @@ function generateContent(exampleNumber, displayTrendingContent) {
const renderedContentCollection = [];
const urlsToResolve = [];
response.forEach(r =>{
response.forEach(r => {
urlsToResolve.push(r.canonical_url);
});
lbrytvAPI.resolve(urlsToResolve)
.then(resolveResponse => {
if (resolveResponse !== null) {
let responses = Object.values(resolveResponse);
const responses = Object.values(resolveResponse);
for (let r in responses) {
let part = responses[r];
for (const r in responses) {
const part = responses[r];
if (part.value && part.value.thumbnail.url) {
renderedContentCollection.push(`
@ -188,10 +188,10 @@ function generateContent(exampleNumber, displayTrendingContent) {
lbrytvAPI.resolve(approvedUrls)
.then(resolveResponse => {
if (resolveResponse !== null) {
let responses = Object.values(resolveResponse);
const responses = Object.values(resolveResponse);
for (let r in responses) {
let part = responses[r];
for (const r in responses) {
const part = responses[r];
if (part.value && part.value.thumbnail.url) {
renderedContentCollection.push(`