Fix empty search

pull/4300/head
Chocobozzz 2021-07-29 15:51:19 +02:00
parent 7e8f19603b
commit 916bf5283b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 6 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import { forkJoin, of, Subscription } from 'rxjs'
import { forkJoin, Subscription } from 'rxjs'
import { LinkType } from 'src/types/link.type'
import { Component, OnDestroy, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
@ -19,7 +19,7 @@ import { HTMLServerConfig, SearchTargetType } from '@shared/models'
export class SearchComponent implements OnInit, OnDestroy {
error: string
results: (Video | VideoChannel)[] = []
results: (Video | VideoChannel | VideoPlaylist)[] = []
pagination = {
currentPage: 1,
@ -283,8 +283,6 @@ export class SearchComponent implements OnInit, OnDestroy {
}
private getVideoChannelObs () {
if (!this.currentSearch) return of({ data: [], total: 0 })
const params = {
search: this.currentSearch,
componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.channelsPerPage }),
@ -301,8 +299,6 @@ export class SearchComponent implements OnInit, OnDestroy {
}
private getVideoPlaylistObs () {
if (!this.currentSearch) return of({ data: [], total: 0 })
const params = {
search: this.currentSearch,
componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.playlistsPerPage }),

View File

@ -79,7 +79,8 @@ export class SearchService {
let params = new HttpParams()
params = this.restService.addRestGetParams(params, pagination)
params = params.append('search', search)
if (search) params = params.append('search', search)
if (advancedSearch) {
const advancedSearchObject = advancedSearch.toChannelAPIObject()
@ -110,7 +111,8 @@ export class SearchService {
let params = new HttpParams()
params = this.restService.addRestGetParams(params, pagination)
params = params.append('search', search)
if (search) params = params.append('search', search)
if (advancedSearch) {
const advancedSearchObject = advancedSearch.toPlaylistAPIObject()