import { Injectable } from '@angular/core'
import { ComponentPaginationLight, RestExtractor, RestPagination, RestService } from '@app/core'
import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'
-import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import {
ResultList,
Video as VideoServerModel,
private restService: RestService,
private videoService: VideoService,
private playlistService: VideoPlaylistService
- ) {
- // Add ability to override search endpoint if the user updated this local storage key
- const searchUrl = peertubeLocalStorage.getItem('search-url')
- if (searchUrl) SearchService.BASE_SEARCH_URL = searchUrl
- }
+ ) { }
searchVideos (parameters: {
search?: string
}): Observable<ResultList<Video>> {
const { search, uuids, componentPagination, advancedSearch } = parameters
- if (advancedSearch.resultType !== undefined && advancedSearch.resultType !== 'videos') {
+ if (advancedSearch?.resultType !== undefined && advancedSearch.resultType !== 'videos') {
return of({ total: 0, data: [] })
}
}): Observable<ResultList<VideoChannel>> {
const { search, advancedSearch, componentPagination, handles } = parameters
- if (advancedSearch.resultType !== undefined && advancedSearch.resultType !== 'channels') {
+ if (advancedSearch?.resultType !== undefined && advancedSearch.resultType !== 'channels') {
return of({ total: 0, data: [] })
}
}): Observable<ResultList<VideoPlaylist>> {
const { search, advancedSearch, componentPagination, uuids } = parameters
- if (advancedSearch.resultType !== undefined && advancedSearch.resultType !== 'playlists') {
+ if (advancedSearch?.resultType !== undefined && advancedSearch.resultType !== 'playlists') {
return of({ total: 0, data: [] })
}