From 916bf5283b90935c166966918d895cf6f55e24f7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 29 Jul 2021 15:51:19 +0200 Subject: [PATCH] Fix empty search --- client/src/app/+search/search.component.ts | 8 ++------ client/src/app/shared/shared-search/search.service.ts | 6 ++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts index 250062e0c..7425b7016 100644 --- a/client/src/app/+search/search.component.ts +++ b/client/src/app/+search/search.component.ts @@ -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 }), diff --git a/client/src/app/shared/shared-search/search.service.ts b/client/src/app/shared/shared-search/search.service.ts index 2c26eb2e5..a1603da98 100644 --- a/client/src/app/shared/shared-search/search.service.ts +++ b/client/src/app/shared/shared-search/search.service.ts @@ -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()