fix: linting errors

This commit is contained in:
Igor Gassmann 2018-04-05 11:27:29 -04:00
parent 950277f243
commit c7d65ad378
3 changed files with 15 additions and 27 deletions

View file

@ -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,

View file

@ -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));
}
};

View file

@ -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,