Fix videos list params
authorChocobozzz <me@florianbigard.com>
Tue, 27 Mar 2018 15:10:56 +0000 (17:10 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 27 Mar 2018 15:10:56 +0000 (17:10 +0200)
client/src/app/shared/video/abstract-video-list.ts
client/src/app/videos/video-list/video-search.component.ts

index c18ebcf5463d5c893b853c337ba67aa8ff79df00..90a88544a60e6e294dbc64b8828c7bd5e42dbc88 100644 (file)
@@ -54,7 +54,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
 
   ngOnInit () {
     // Subscribe to route changes
-    const routeParams = this.route.snapshot.params
+    const routeParams = this.route.snapshot.queryParams
     this.loadRouteParams(routeParams)
 
     this.resizeSubscription = fromEvent(window, 'resize')
@@ -162,7 +162,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
 
   protected setNewRouteParams () {
     const routeParams = this.buildRouteParams()
-    this.router.navigate([ this.currentRoute, routeParams ])
+    this.router.navigate([ this.currentRoute ],  { queryParams: routeParams })
   }
 
   protected buildVideoPages () {
index 67857a0a9cf9fc53a3c743ea3246324b2a7fad54..b94be8e118683e78edbccc52d2bd94aec96c5a86 100644 (file)
@@ -39,6 +39,7 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O
     this.subActivatedRoute = this.route.queryParams.subscribe(
       queryParams => {
         const querySearch = queryParams['search']
+
         if (!querySearch) return this.redirectService.redirectToHomepage()
         if (this.otherRouteParams.search === querySearch) return