aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-29 15:51:19 +0200
committerChocobozzz <me@florianbigard.com>2021-07-29 15:51:19 +0200
commit916bf5283b90935c166966918d895cf6f55e24f7 (patch)
treeb67ec2ab1a79183884e2cde2dec423f9cd453f75 /client/src/app
parent7e8f19603ba314706141f58c9fe8a50eb0ffa7b2 (diff)
downloadPeerTube-916bf5283b90935c166966918d895cf6f55e24f7.tar.gz
PeerTube-916bf5283b90935c166966918d895cf6f55e24f7.tar.zst
PeerTube-916bf5283b90935c166966918d895cf6f55e24f7.zip
Fix empty search
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+search/search.component.ts8
-rw-r--r--client/src/app/shared/shared-search/search.service.ts6
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 @@
1import { forkJoin, of, Subscription } from 'rxjs' 1import { forkJoin, Subscription } from 'rxjs'
2import { LinkType } from 'src/types/link.type' 2import { LinkType } from 'src/types/link.type'
3import { Component, OnDestroy, OnInit } from '@angular/core' 3import { Component, OnDestroy, OnInit } from '@angular/core'
4import { ActivatedRoute, Router } from '@angular/router' 4import { ActivatedRoute, Router } from '@angular/router'
@@ -19,7 +19,7 @@ import { HTMLServerConfig, SearchTargetType } from '@shared/models'
19export class SearchComponent implements OnInit, OnDestroy { 19export class SearchComponent implements OnInit, OnDestroy {
20 error: string 20 error: string
21 21
22 results: (Video | VideoChannel)[] = [] 22 results: (Video | VideoChannel | VideoPlaylist)[] = []
23 23
24 pagination = { 24 pagination = {
25 currentPage: 1, 25 currentPage: 1,
@@ -283,8 +283,6 @@ export class SearchComponent implements OnInit, OnDestroy {
283 } 283 }
284 284
285 private getVideoChannelObs () { 285 private getVideoChannelObs () {
286 if (!this.currentSearch) return of({ data: [], total: 0 })
287
288 const params = { 286 const params = {
289 search: this.currentSearch, 287 search: this.currentSearch,
290 componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.channelsPerPage }), 288 componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.channelsPerPage }),
@@ -301,8 +299,6 @@ export class SearchComponent implements OnInit, OnDestroy {
301 } 299 }
302 300
303 private getVideoPlaylistObs () { 301 private getVideoPlaylistObs () {
304 if (!this.currentSearch) return of({ data: [], total: 0 })
305
306 const params = { 302 const params = {
307 search: this.currentSearch, 303 search: this.currentSearch,
308 componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.playlistsPerPage }), 304 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 {
79 79
80 let params = new HttpParams() 80 let params = new HttpParams()
81 params = this.restService.addRestGetParams(params, pagination) 81 params = this.restService.addRestGetParams(params, pagination)
82 params = params.append('search', search) 82
83 if (search) params = params.append('search', search)
83 84
84 if (advancedSearch) { 85 if (advancedSearch) {
85 const advancedSearchObject = advancedSearch.toChannelAPIObject() 86 const advancedSearchObject = advancedSearch.toChannelAPIObject()
@@ -110,7 +111,8 @@ export class SearchService {
110 111
111 let params = new HttpParams() 112 let params = new HttpParams()
112 params = this.restService.addRestGetParams(params, pagination) 113 params = this.restService.addRestGetParams(params, pagination)
113 params = params.append('search', search) 114
115 if (search) params = params.append('search', search)
114 116
115 if (advancedSearch) { 117 if (advancedSearch) {
116 const advancedSearchObject = advancedSearch.toPlaylistAPIObject() 118 const advancedSearchObject = advancedSearch.toPlaylistAPIObject()