diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-10 11:02:42 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-10 11:02:42 +0100 |
commit | 8cf43a6524d354fbfa0f0eaf789e8d4756bd25d6 (patch) | |
tree | 3f33a5e36a89eedf7e4ebfa4d08336262e9604c2 /client/src/app/shared/shared-search/search.service.ts | |
parent | 90701ec1d8d27d0072d6b0d2b19362d471484f9a (diff) | |
download | PeerTube-8cf43a6524d354fbfa0f0eaf789e8d4756bd25d6.tar.gz PeerTube-8cf43a6524d354fbfa0f0eaf789e8d4756bd25d6.tar.zst PeerTube-8cf43a6524d354fbfa0f0eaf789e8d4756bd25d6.zip |
Add filter on search results
Diffstat (limited to 'client/src/app/shared/shared-search/search.service.ts')
-rw-r--r-- | client/src/app/shared/shared-search/search.service.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/client/src/app/shared/shared-search/search.service.ts b/client/src/app/shared/shared-search/search.service.ts index 71350c733..415bf083c 100644 --- a/client/src/app/shared/shared-search/search.service.ts +++ b/client/src/app/shared/shared-search/search.service.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Observable } from 'rxjs' | 1 | import { Observable, of } from 'rxjs' |
2 | import { catchError, map, switchMap } from 'rxjs/operators' | 2 | import { catchError, map, switchMap } from 'rxjs/operators' |
3 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpParams } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
@@ -39,6 +39,10 @@ export class SearchService { | |||
39 | }): Observable<ResultList<Video>> { | 39 | }): Observable<ResultList<Video>> { |
40 | const { search, uuids, componentPagination, advancedSearch } = parameters | 40 | const { search, uuids, componentPagination, advancedSearch } = parameters |
41 | 41 | ||
42 | if (advancedSearch.resultType !== undefined && advancedSearch.resultType !== 'videos') { | ||
43 | return of({ total: 0, data: [] }) | ||
44 | } | ||
45 | |||
42 | const url = SearchService.BASE_SEARCH_URL + 'videos' | 46 | const url = SearchService.BASE_SEARCH_URL + 'videos' |
43 | let pagination: RestPagination | 47 | let pagination: RestPagination |
44 | 48 | ||
@@ -73,6 +77,10 @@ export class SearchService { | |||
73 | }): Observable<ResultList<VideoChannel>> { | 77 | }): Observable<ResultList<VideoChannel>> { |
74 | const { search, advancedSearch, componentPagination, handles } = parameters | 78 | const { search, advancedSearch, componentPagination, handles } = parameters |
75 | 79 | ||
80 | if (advancedSearch.resultType !== undefined && advancedSearch.resultType !== 'channels') { | ||
81 | return of({ total: 0, data: [] }) | ||
82 | } | ||
83 | |||
76 | const url = SearchService.BASE_SEARCH_URL + 'video-channels' | 84 | const url = SearchService.BASE_SEARCH_URL + 'video-channels' |
77 | 85 | ||
78 | let pagination: RestPagination | 86 | let pagination: RestPagination |
@@ -107,6 +115,10 @@ export class SearchService { | |||
107 | }): Observable<ResultList<VideoPlaylist>> { | 115 | }): Observable<ResultList<VideoPlaylist>> { |
108 | const { search, advancedSearch, componentPagination, uuids } = parameters | 116 | const { search, advancedSearch, componentPagination, uuids } = parameters |
109 | 117 | ||
118 | if (advancedSearch.resultType !== undefined && advancedSearch.resultType !== 'playlists') { | ||
119 | return of({ total: 0, data: [] }) | ||
120 | } | ||
121 | |||
110 | const url = SearchService.BASE_SEARCH_URL + 'video-playlists' | 122 | const url = SearchService.BASE_SEARCH_URL + 'video-playlists' |
111 | 123 | ||
112 | let pagination: RestPagination | 124 | let pagination: RestPagination |