From eefac4af0dd539b8e7dd7b193fd664e426948cb4 Mon Sep 17 00:00:00 2001 From: zeppi Date: Sun, 12 Sep 2021 19:38:45 -0400 Subject: [PATCH] lint --- dist/bundle.es.js | 25 +++++-------------------- dist/bundle.js | 21 ++++----------------- src/lbryio.js | 22 ++++------------------ 3 files changed, 13 insertions(+), 55 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 4a9e1fc..c735af7 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -276,7 +276,7 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => { if (action === 'me') { if (tokens && tokens.access_token) { - headers.Authorization = 'Bearer ' + tokens.access_token; + headers.Authorization = `Bearer ${tokens.access_token}`; } if (tokens && tokens.auth_token) { @@ -284,7 +284,7 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => { } } else { if (tokens && tokens.access_token) { - headers.Authorization = 'Bearer ' + tokens.access_token; + headers.Authorization = `Bearer ${tokens.access_token}`; } else { fullParams.auth_token = tokens.auth_token; } @@ -337,22 +337,7 @@ Lbryio.getTokens = () => new Promise(resolve => { }); }); -Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); // const getAppId = - - -Lbryio.getUserNew = options => { - const { - language, - appId, - auth_token, - authorization - } = options; - Lbryio.call('user', 'new', { - auth_token: '', - language: language || 'en', - app_id: appId - }, 'post'); -}; +Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); /** * LBRYIO.AUTHENTICATE() * @param domain @@ -395,8 +380,8 @@ Lbryio.authenticate = (domain, language) => { if (Lbryio.authenticationPromise === null) { Lbryio.authenticationPromise = new Promise((resolve, reject) => { // see if we already have a token - Lbryio.getAuthToken().then(token => { - if (!token) { + Lbryio.getTokens().then(tokens => { + if (!tokens) { return false; } // check that token works diff --git a/dist/bundle.js b/dist/bundle.js index e1667d8..a8ca37d 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -569,7 +569,7 @@ Lbryio.call = function (resource, action) { if (action === 'me') { if (tokens && tokens.access_token) { - headers.Authorization = 'Bearer ' + tokens.access_token; + headers.Authorization = "Bearer ".concat(tokens.access_token); } if (tokens && tokens.auth_token) { @@ -577,7 +577,7 @@ Lbryio.call = function (resource, action) { } } else { if (tokens && tokens.access_token) { - headers.Authorization = 'Bearer ' + tokens.access_token; + headers.Authorization = "Bearer ".concat(tokens.access_token); } else { fullParams.auth_token = tokens.auth_token; } @@ -638,19 +638,6 @@ Lbryio.getTokens = function () { Lbryio.getCurrentUser = function () { return Lbryio.call('user', 'me'); -}; // const getAppId = - - -Lbryio.getUserNew = function (options) { - var language = options.language, - appId = options.appId, - auth_token = options.auth_token, - authorization = options.authorization; - Lbryio.call('user', 'new', { - auth_token: '', - language: language || 'en', - app_id: appId - }, 'post'); }; /** * LBRYIO.AUTHENTICATE() @@ -694,8 +681,8 @@ Lbryio.authenticate = function (domain, language) { if (Lbryio.authenticationPromise === null) { Lbryio.authenticationPromise = new Promise(function (resolve, reject) { // see if we already have a token - Lbryio.getAuthToken().then(function (token) { - if (!token) { + Lbryio.getTokens().then(function (tokens) { + if (!tokens) { return false; } // check that token works diff --git a/src/lbryio.js b/src/lbryio.js index c366b90..2b1ee3a 100644 --- a/src/lbryio.js +++ b/src/lbryio.js @@ -66,14 +66,14 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => { // find a way to trigger deleting auth token after success if (action === 'me') { if (tokens && tokens.access_token) { - headers.Authorization = 'Bearer ' + tokens.access_token; + headers.Authorization = `Bearer ${tokens.access_token}`; } if (tokens && tokens.auth_token) { fullParams.auth_token = tokens.auth_token; } } else { if (tokens && tokens.access_token) { - headers.Authorization = 'Bearer ' + tokens.access_token; + headers.Authorization = `Bearer ${tokens.access_token}`; } else { fullParams.auth_token = tokens.auth_token; } @@ -129,20 +129,6 @@ Lbryio.getTokens = () => new Promise(resolve => { Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); -// const getAppId = -// Lbryio.getUserNew = (options) => { -// const { language, appId, auth_token, authorization } = options; -// Lbryio.call( -// 'user', -// 'new', -// { -// auth_token: '', -// language: language || 'en', -// app_id: appId, -// }, -// 'post' -// )} - /** * LBRYIO.AUTHENTICATE() * @param domain @@ -185,8 +171,8 @@ Lbryio.authenticate = (domain, language) => { Lbryio.authenticationPromise = new Promise((resolve, reject) => { // see if we already have a token Lbryio.getTokens() - .then(token => { - if (!token) { + .then(tokens => { + if (!tokens) { return false; }