From c7d65ad3783a0e6cac1e3ac211f7b4b8b2ae57f1 Mon Sep 17 00:00:00 2001 From: Igor Gassmann Date: Thu, 5 Apr 2018 11:27:29 -0400 Subject: [PATCH] fix: linting errors --- src/lbry.js | 12 ------------ src/redux/actions/search.js | 28 ++++++++++++++-------------- src/redux/actions/wallet.js | 2 +- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/lbry.js b/src/lbry.js index f287d1f..1e1b783 100644 --- a/src/lbry.js +++ b/src/lbry.js @@ -49,16 +49,6 @@ function apiCall(method: string, params: ?{}, resolve: Function, reject: Functio .catch(reject); } -function getLocal(key, fallback = undefined) { - // const itemRaw = localStorage.getItem(key); - const itemRaw = null; - return itemRaw === null ? fallback : JSON.parse(itemRaw); -} - -function setLocal(key, value) { - // localStorage.setItem(key, JSON.stringify(value)); -} - // core Lbry.status = () => new Promise((resolve, reject) => { @@ -141,8 +131,6 @@ Lbry.getMediaType = (contentType, fileName) => { */ Lbry.file_list = (params = {}) => new Promise((resolve, reject) => { - const { claim_name: claimName, channel_name: channelName, outpoint } = params; - apiCall( 'file_list', params, diff --git a/src/redux/actions/search.js b/src/redux/actions/search.js index 7a2e009..807a707 100644 --- a/src/redux/actions/search.js +++ b/src/redux/actions/search.js @@ -69,18 +69,6 @@ export const doSearch = rawQuery => (dispatch, getState) => { }); }; -export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => dispatch => { - dispatch({ - type: ACTIONS.UPDATE_SEARCH_QUERY, - data: { query }, - }); - - // Don't fetch new suggestions if the user just added a space - if (!query.endsWith(' ') || !shouldSkipSuggestions) { - dispatch(getSearchSuggestions(query)); - } -}; - export const getSearchSuggestions = (value: string) => dispatch => { const query = value.trim(); @@ -121,7 +109,7 @@ export const getSearchSuggestions = (value: string) => dispatch => { ); // If it's a valid url, don't fetch any extra search results - return dispatch({ + dispatch({ type: ACTIONS.UPDATE_SEARCH_SUGGESTIONS, data: { suggestions }, }); @@ -146,7 +134,7 @@ export const getSearchSuggestions = (value: string) => dispatch => { searchValue = searchValue.substring(0, searchValue.indexOf('#')); } - return fetch(`https://lighthouse.lbry.io/autocomplete?s=${searchValue}`) + fetch(`https://lighthouse.lbry.io/autocomplete?s=${searchValue}`) .then(handleFetchResponse) .then(apiSuggestions => { const formattedSuggestions = apiSuggestions.slice(0, 6).map(suggestion => { @@ -172,3 +160,15 @@ export const getSearchSuggestions = (value: string) => dispatch => { // Basic search suggestions are already populated at this point }); }; + +export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => dispatch => { + dispatch({ + type: ACTIONS.UPDATE_SEARCH_QUERY, + data: { query }, + }); + + // Don't fetch new suggestions if the user just added a space + if (!query.endsWith(' ') || !shouldSkipSuggestions) { + dispatch(getSearchSuggestions(query)); + } +}; diff --git a/src/redux/actions/wallet.js b/src/redux/actions/wallet.js index 728ba2d..aa7ffea 100644 --- a/src/redux/actions/wallet.js +++ b/src/redux/actions/wallet.js @@ -12,7 +12,7 @@ export function doUpdateBalance() { const { wallet: { balance: balanceInStore } } = getState(); Lbry.wallet_balance().then(balance => { if (balanceInStore !== balance) { - return dispatch({ + dispatch({ type: ACTIONS.UPDATE_BALANCE, data: { balance,