]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/angular/videos/components/list/videos-list.component.ts
Make the sort/results bar less ugly
[github/Chocobozzz/PeerTube.git] / client / angular / videos / components / list / videos-list.component.ts
index 98fe7b15313c21f95ac901e9c9e52f34569a972c..94b064e163aa7654a6ccb4b9863a4518abd117b2 100644 (file)
@@ -27,7 +27,7 @@ export class VideosListComponent implements OnInit {
     currentPage: 1,
     itemsPerPage: 9,
     total: 0
-  }
+  };
   sort: SortField;
 
   private search: Search;
@@ -41,7 +41,7 @@ export class VideosListComponent implements OnInit {
     this.search = {
       value: this._routeParams.get('search'),
       field: <SearchField>this._routeParams.get('field')
-    }
+    };
 
     this.sort = <SortField>this._routeParams.get('sort') || '-createdDate';
   }
@@ -78,7 +78,17 @@ export class VideosListComponent implements OnInit {
 
   onSort(sort: SortField) {
     this.sort = sort;
-    this._router.navigate(['VideosList', { sort: this.sort }]);
+
+    const params: any = {
+      sort: this.sort
+    };
+
+    if (this.search.value) {
+      params.search = this.search.value;
+      params.field = this.search.field;
+    }
+
+    this._router.navigate(['VideosList', params]);
     this.getVideos();
   }
 }