fix: linting errors
This commit is contained in:
parent
950277f243
commit
c7d65ad378
3 changed files with 15 additions and 27 deletions
12
src/lbry.js
12
src/lbry.js
|
@ -49,16 +49,6 @@ function apiCall(method: string, params: ?{}, resolve: Function, reject: Functio
|
||||||
.catch(reject);
|
.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
|
// core
|
||||||
Lbry.status = () =>
|
Lbry.status = () =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
|
@ -141,8 +131,6 @@ Lbry.getMediaType = (contentType, fileName) => {
|
||||||
*/
|
*/
|
||||||
Lbry.file_list = (params = {}) =>
|
Lbry.file_list = (params = {}) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
const { claim_name: claimName, channel_name: channelName, outpoint } = params;
|
|
||||||
|
|
||||||
apiCall(
|
apiCall(
|
||||||
'file_list',
|
'file_list',
|
||||||
params,
|
params,
|
||||||
|
|
|
@ -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 => {
|
export const getSearchSuggestions = (value: string) => dispatch => {
|
||||||
const query = value.trim();
|
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
|
// If it's a valid url, don't fetch any extra search results
|
||||||
return dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_SEARCH_SUGGESTIONS,
|
type: ACTIONS.UPDATE_SEARCH_SUGGESTIONS,
|
||||||
data: { suggestions },
|
data: { suggestions },
|
||||||
});
|
});
|
||||||
|
@ -146,7 +134,7 @@ export const getSearchSuggestions = (value: string) => dispatch => {
|
||||||
searchValue = searchValue.substring(0, searchValue.indexOf('#'));
|
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(handleFetchResponse)
|
||||||
.then(apiSuggestions => {
|
.then(apiSuggestions => {
|
||||||
const formattedSuggestions = apiSuggestions.slice(0, 6).map(suggestion => {
|
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
|
// 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));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ export function doUpdateBalance() {
|
||||||
const { wallet: { balance: balanceInStore } } = getState();
|
const { wallet: { balance: balanceInStore } } = getState();
|
||||||
Lbry.wallet_balance().then(balance => {
|
Lbry.wallet_balance().then(balance => {
|
||||||
if (balanceInStore !== balance) {
|
if (balanceInStore !== balance) {
|
||||||
return dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_BALANCE,
|
type: ACTIONS.UPDATE_BALANCE,
|
||||||
data: {
|
data: {
|
||||||
balance,
|
balance,
|
||||||
|
|
Loading…
Reference in a new issue