mirror of https://github.com/Chocobozzz/PeerTube
Fix empty search
parent
7e8f19603b
commit
916bf5283b
|
@ -1,4 +1,4 @@
|
||||||
import { forkJoin, of, Subscription } from 'rxjs'
|
import { forkJoin, Subscription } from 'rxjs'
|
||||||
import { LinkType } from 'src/types/link.type'
|
import { LinkType } from 'src/types/link.type'
|
||||||
import { Component, OnDestroy, OnInit } from '@angular/core'
|
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||||
import { ActivatedRoute, Router } from '@angular/router'
|
import { ActivatedRoute, Router } from '@angular/router'
|
||||||
|
@ -19,7 +19,7 @@ import { HTMLServerConfig, SearchTargetType } from '@shared/models'
|
||||||
export class SearchComponent implements OnInit, OnDestroy {
|
export class SearchComponent implements OnInit, OnDestroy {
|
||||||
error: string
|
error: string
|
||||||
|
|
||||||
results: (Video | VideoChannel)[] = []
|
results: (Video | VideoChannel | VideoPlaylist)[] = []
|
||||||
|
|
||||||
pagination = {
|
pagination = {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
@ -283,8 +283,6 @@ export class SearchComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getVideoChannelObs () {
|
private getVideoChannelObs () {
|
||||||
if (!this.currentSearch) return of({ data: [], total: 0 })
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
search: this.currentSearch,
|
search: this.currentSearch,
|
||||||
componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.channelsPerPage }),
|
componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.channelsPerPage }),
|
||||||
|
@ -301,8 +299,6 @@ export class SearchComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getVideoPlaylistObs () {
|
private getVideoPlaylistObs () {
|
||||||
if (!this.currentSearch) return of({ data: [], total: 0 })
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
search: this.currentSearch,
|
search: this.currentSearch,
|
||||||
componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.playlistsPerPage }),
|
componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.playlistsPerPage }),
|
||||||
|
|
|
@ -79,7 +79,8 @@ export class SearchService {
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.restService.addRestGetParams(params, pagination)
|
params = this.restService.addRestGetParams(params, pagination)
|
||||||
params = params.append('search', search)
|
|
||||||
|
if (search) params = params.append('search', search)
|
||||||
|
|
||||||
if (advancedSearch) {
|
if (advancedSearch) {
|
||||||
const advancedSearchObject = advancedSearch.toChannelAPIObject()
|
const advancedSearchObject = advancedSearch.toChannelAPIObject()
|
||||||
|
@ -110,7 +111,8 @@ export class SearchService {
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.restService.addRestGetParams(params, pagination)
|
params = this.restService.addRestGetParams(params, pagination)
|
||||||
params = params.append('search', search)
|
|
||||||
|
if (search) params = params.append('search', search)
|
||||||
|
|
||||||
if (advancedSearch) {
|
if (advancedSearch) {
|
||||||
const advancedSearchObject = advancedSearch.toPlaylistAPIObject()
|
const advancedSearchObject = advancedSearch.toPlaylistAPIObject()
|
||||||
|
|
Loading…
Reference in New Issue