Resolved search updates #273
2 changed files with 12 additions and 8 deletions
5
dist/bundle.es.js
vendored
5
dist/bundle.es.js
vendored
|
@ -4112,7 +4112,7 @@ const doSearch = (rawQuery, searchOptions) => (dispatch, getState) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const doResolvedSearch = (rawQuery, size, // only pass in if you don't want to use the users setting (ex: related content)
|
const doResolvedSearch = (rawQuery, size, // only pass in if you don't want to use the users setting (ex: related content)
|
||||||
from, isBackgroundSearch = false, options = {}) => (dispatch, getState) => {
|
from, isBackgroundSearch = false, options = {}, nsfw) => (dispatch, getState) => {
|
||||||
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
|
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
|
||||||
|
|
||||||
if (!query) {
|
if (!query) {
|
||||||
|
@ -4155,7 +4155,8 @@ from, isBackgroundSearch = false, options = {}) => (dispatch, getState) => {
|
||||||
dispatch(doUpdateSearchQuery(query));
|
dispatch(doUpdateSearchQuery(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(`${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`).then(handleFetchResponse).then(data => {
|
const fetchUrl = nsfw ? `${CONNECTION_STRING}search?resolve=true&${queryWithOptions}` : `${CONNECTION_STRING}search?resolve=true&nsfw=false&${queryWithOptions}`;
|
||||||
|
fetch(fetchUrl).then(handleFetchResponse).then(data => {
|
||||||
const results = [];
|
const results = [];
|
||||||
|
|
||||||
data.forEach(result => {
|
data.forEach(result => {
|
||||||
|
|
|
@ -166,13 +166,13 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => (
|
||||||
|
|
||||||
export const doResolvedSearch = (
|
export const doResolvedSearch = (
|
||||||
rawQuery: string,
|
rawQuery: string,
|
||||||
size?: number, // only pass in if you don't want to use the users setting (ex: related content)
|
size: ?number, // only pass in if you don't want to use the users setting (ex: related content)
|
||||||
from?: number,
|
from: ?number,
|
||||||
isBackgroundSearch?: boolean = false,
|
isBackgroundSearch: boolean = false,
|
||||||
options: {
|
options: {
|
||||||
related_to?: string,
|
related_to?: string,
|
||||||
// nsfw here
|
} = {},
|
||||||
} = {}
|
nsfw: boolean
|
||||||
) => (dispatch: Dispatch, getState: GetState) => {
|
) => (dispatch: Dispatch, getState: GetState) => {
|
||||||
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
|
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
|
||||||
|
|
||||||
|
@ -218,7 +218,10 @@ export const doResolvedSearch = (
|
||||||
dispatch(doUpdateSearchQuery(query));
|
dispatch(doUpdateSearchQuery(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(`${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`)
|
const fetchUrl = nsfw
|
||||||
|
? `${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`
|
||||||
|
: `${CONNECTION_STRING}search?resolve=true&nsfw=false&${queryWithOptions}`;
|
||||||
|
fetch(fetchUrl)
|
||||||
.then(handleFetchResponse)
|
.then(handleFetchResponse)
|
||||||
.then((data: Array<ResolvedSearchResult>) => {
|
.then((data: Array<ResolvedSearchResult>) => {
|
||||||
const results = [];
|
const results = [];
|
||||||
|
|
Loading…
Reference in a new issue