Fix mediaType filter parameter in search

This commit is contained in:
Franco Montenegro 2021-02-12 14:14:53 -03:00 committed by Sean Yesmunt
parent e2d30e708e
commit 62c7216b43

View file

@ -10,10 +10,10 @@ export function parseQueryParams(queryString: string) {
.split('?') .split('?')
.pop() .pop()
.split('&') .split('&')
.map(p => p.split('=')); .map((p) => p.split('='));
const params = {}; const params = {};
parts.forEach(array => { parts.forEach((array) => {
const [first, second] = array; const [first, second] = array;
params[first] = second; params[first] = second;
}); });
@ -46,8 +46,9 @@ export const getSearchQueryString = (query: string, options: any = {}) => {
if (claimType) { if (claimType) {
queryParams.push(`claimType=${claimType}`); queryParams.push(`claimType=${claimType}`);
// If they are only searching for channels, strip out the media info const searchingFiles = claimType.includes(SEARCH_OPTIONS.INCLUDE_FILES);
if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) {
if (searchingFiles) {
queryParams.push( queryParams.push(
`mediaType=${[ `mediaType=${[
SEARCH_OPTIONS.MEDIA_FILE, SEARCH_OPTIONS.MEDIA_FILE,
@ -69,7 +70,7 @@ export const getSearchQueryString = (query: string, options: any = {}) => {
if (nsfw === false) additionalOptions['nsfw'] = false; if (nsfw === false) additionalOptions['nsfw'] = false;
if (additionalOptions) { if (additionalOptions) {
Object.keys(additionalOptions).forEach(key => { Object.keys(additionalOptions).forEach((key) => {
const option = additionalOptions[key]; const option = additionalOptions[key];
queryParams.push(`${key}=${option}`); queryParams.push(`${key}=${option}`);
}); });