Skip channel search on empty search
authorChocobozzz <me@florianbigard.com>
Wed, 4 Dec 2019 12:29:40 +0000 (13:29 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 4 Dec 2019 12:29:40 +0000 (13:29 +0100)
client/src/app/search/search.component.ts

index 202b97ab30847fba5b75ee6489ad348ef1d38da6..dfd8d882332ef5e47af21d1bb3fcbb396ffd23aa 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { AuthService, Notifier } from '@app/core'
-import { forkJoin, Subscription } from 'rxjs'
+import { forkJoin, of, Subscription } from 'rxjs'
 import { SearchService } from '@app/search/search.service'
 import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
 import { I18n } from '@ngx-translate/i18n-polyfill'
@@ -184,6 +184,8 @@ export class SearchComponent implements OnInit, OnDestroy {
   }
 
   private getVideoChannelObs () {
+    if (!this.currentSearch) return of({ data: [], total: 0 })
+
     const params = {
       search: this.currentSearch,
       componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.channelsPerPage })