diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-02 15:29:09 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-02 15:40:09 +0200 |
commit | 3da38d6e9f8d600476be276666ac7223aa5f172c (patch) | |
tree | daec25cccb900a0f90fc9d2273099683b42d8551 /client/src/app/shared/shared-search/search.service.ts | |
parent | 200eaf5152ca72fe6b05a49caf819e22bd045b37 (diff) | |
download | PeerTube-3da38d6e9f8d600476be276666ac7223aa5f172c.tar.gz PeerTube-3da38d6e9f8d600476be276666ac7223aa5f172c.tar.zst PeerTube-3da38d6e9f8d600476be276666ac7223aa5f172c.zip |
Fetch things in bulk for the homepage
Diffstat (limited to 'client/src/app/shared/shared-search/search.service.ts')
-rw-r--r-- | client/src/app/shared/shared-search/search.service.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-search/search.service.ts b/client/src/app/shared/shared-search/search.service.ts index a1603da98..fdfab0e0e 100644 --- a/client/src/app/shared/shared-search/search.service.ts +++ b/client/src/app/shared/shared-search/search.service.ts | |||
@@ -32,11 +32,12 @@ export class SearchService { | |||
32 | } | 32 | } |
33 | 33 | ||
34 | searchVideos (parameters: { | 34 | searchVideos (parameters: { |
35 | search: string | 35 | search?: string |
36 | componentPagination?: ComponentPaginationLight | 36 | componentPagination?: ComponentPaginationLight |
37 | advancedSearch?: AdvancedSearch | 37 | advancedSearch?: AdvancedSearch |
38 | uuids?: string[] | ||
38 | }): Observable<ResultList<Video>> { | 39 | }): Observable<ResultList<Video>> { |
39 | const { search, componentPagination, advancedSearch } = parameters | 40 | const { search, uuids, componentPagination, advancedSearch } = parameters |
40 | 41 | ||
41 | const url = SearchService.BASE_SEARCH_URL + 'videos' | 42 | const url = SearchService.BASE_SEARCH_URL + 'videos' |
42 | let pagination: RestPagination | 43 | let pagination: RestPagination |
@@ -49,6 +50,7 @@ export class SearchService { | |||
49 | params = this.restService.addRestGetParams(params, pagination) | 50 | params = this.restService.addRestGetParams(params, pagination) |
50 | 51 | ||
51 | if (search) params = params.append('search', search) | 52 | if (search) params = params.append('search', search) |
53 | if (uuids) params = this.restService.addArrayParams(params, 'uuids', uuids) | ||
52 | 54 | ||
53 | if (advancedSearch) { | 55 | if (advancedSearch) { |
54 | const advancedSearchObject = advancedSearch.toVideosAPIObject() | 56 | const advancedSearchObject = advancedSearch.toVideosAPIObject() |
@@ -64,11 +66,12 @@ export class SearchService { | |||
64 | } | 66 | } |
65 | 67 | ||
66 | searchVideoChannels (parameters: { | 68 | searchVideoChannels (parameters: { |
67 | search: string | 69 | search?: string |
68 | advancedSearch?: AdvancedSearch | 70 | advancedSearch?: AdvancedSearch |
69 | componentPagination?: ComponentPaginationLight | 71 | componentPagination?: ComponentPaginationLight |
72 | handles?: string[] | ||
70 | }): Observable<ResultList<VideoChannel>> { | 73 | }): Observable<ResultList<VideoChannel>> { |
71 | const { search, advancedSearch, componentPagination } = parameters | 74 | const { search, advancedSearch, componentPagination, handles } = parameters |
72 | 75 | ||
73 | const url = SearchService.BASE_SEARCH_URL + 'video-channels' | 76 | const url = SearchService.BASE_SEARCH_URL + 'video-channels' |
74 | 77 | ||
@@ -81,6 +84,7 @@ export class SearchService { | |||
81 | params = this.restService.addRestGetParams(params, pagination) | 84 | params = this.restService.addRestGetParams(params, pagination) |
82 | 85 | ||
83 | if (search) params = params.append('search', search) | 86 | if (search) params = params.append('search', search) |
87 | if (handles) params = this.restService.addArrayParams(params, 'handles', handles) | ||
84 | 88 | ||
85 | if (advancedSearch) { | 89 | if (advancedSearch) { |
86 | const advancedSearchObject = advancedSearch.toChannelAPIObject() | 90 | const advancedSearchObject = advancedSearch.toChannelAPIObject() |
@@ -96,11 +100,12 @@ export class SearchService { | |||
96 | } | 100 | } |
97 | 101 | ||
98 | searchVideoPlaylists (parameters: { | 102 | searchVideoPlaylists (parameters: { |
99 | search: string | 103 | search?: string |
100 | advancedSearch?: AdvancedSearch | 104 | advancedSearch?: AdvancedSearch |
101 | componentPagination?: ComponentPaginationLight | 105 | componentPagination?: ComponentPaginationLight |
106 | uuids?: string[] | ||
102 | }): Observable<ResultList<VideoPlaylist>> { | 107 | }): Observable<ResultList<VideoPlaylist>> { |
103 | const { search, advancedSearch, componentPagination } = parameters | 108 | const { search, advancedSearch, componentPagination, uuids } = parameters |
104 | 109 | ||
105 | const url = SearchService.BASE_SEARCH_URL + 'video-playlists' | 110 | const url = SearchService.BASE_SEARCH_URL + 'video-playlists' |
106 | 111 | ||
@@ -113,6 +118,7 @@ export class SearchService { | |||
113 | params = this.restService.addRestGetParams(params, pagination) | 118 | params = this.restService.addRestGetParams(params, pagination) |
114 | 119 | ||
115 | if (search) params = params.append('search', search) | 120 | if (search) params = params.append('search', search) |
121 | if (uuids) params = this.restService.addArrayParams(params, 'uuids', uuids) | ||
116 | 122 | ||
117 | if (advancedSearch) { | 123 | if (advancedSearch) { |
118 | const advancedSearchObject = advancedSearch.toPlaylistAPIObject() | 124 | const advancedSearchObject = advancedSearch.toPlaylistAPIObject() |