support claim search async dispatch #405

Merged
jessopb merged 1 commit from feat-supportAsyncForDesktop into master 2021-04-23 17:12:45 +02:00
2 changed files with 48 additions and 38 deletions

18
dist/bundle.es.js vendored
View file

@ -4018,16 +4018,17 @@ function doClaimSearch(options = {
page: 1
}) {
const query = createNormalizedClaimSearchKey(options);
return dispatch => {
return (() => {
var _ref2 = _asyncToGenerator$1(function* (dispatch) {
dispatch({
type: CLAIM_SEARCH_STARTED,
data: { query: query }
});
const success = data => {
const success = function (data) {
const resolveInfo = {};
const urls = [];
data.items.forEach(stream => {
data.items.forEach(function (stream) {
resolveInfo[stream.canonical_url] = { stream };
urls.push(stream.canonical_url);
});
@ -4042,20 +4043,27 @@ function doClaimSearch(options = {
pageSize: options.page_size
}
});
return true;
};
const failure = err => {
const failure = function (err) {
dispatch({
type: CLAIM_SEARCH_FAILED,
data: { query },
error: err
});
return false;
};
lbryProxy.claim_search(_extends$5({}, options, {
return yield lbryProxy.claim_search(_extends$5({}, options, {
include_purchase_receipt: true
})).then(success, failure);
});
return function (_x2) {
return _ref2.apply(this, arguments);
};
})();
}
function doRepost(options) {

View file

@ -65,7 +65,7 @@ export function doResolveUris(
} = {};
return Lbry.resolve({ urls: urisToResolve, ...options }).then(
async (result: ResolveResponse) => {
async(result: ResolveResponse) => {
let repostedResults = {};
const repostsToResolve = [];
const fallbackResolveInfo = {
@ -594,7 +594,7 @@ export function doClaimSearch(
}
) {
const query = createNormalizedClaimSearchKey(options);
return (dispatch: Dispatch) => {
return async(dispatch: Dispatch) => {
dispatch({
type: ACTIONS.CLAIM_SEARCH_STARTED,
data: { query: query },
@ -618,6 +618,7 @@ export function doClaimSearch(
pageSize: options.page_size,
},
});
return true;
};
const failure = err => {
@ -626,9 +627,10 @@ export function doClaimSearch(
data: { query },
error: err,
});
return false;
};
Lbry.claim_search({
return await Lbry.claim_search({
...options,
include_purchase_receipt: true,
}).then(success, failure);