]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Replace current state when changing page
authorChocobozzz <me@florianbigard.com>
Fri, 20 Apr 2018 12:27:30 +0000 (14:27 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 20 Apr 2018 12:27:30 +0000 (14:27 +0200)
client/src/app/account/account-videos/account-videos.component.ts
client/src/app/shared/video/abstract-video-list.ts
client/src/app/videos/video-list/video-local.component.ts
client/src/app/videos/video-list/video-recently-added.component.ts
client/src/app/videos/video-list/video-search.component.ts
client/src/app/videos/video-list/video-trending.component.ts

index 07f5b7f0b58f69994323eaedeb7fdcc4392d6ea6..91bc1b695c2cbecbd31b79f829c0190f855cb6f1 100644 (file)
@@ -1,5 +1,6 @@
 import { Component, OnInit, OnDestroy } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
+import { Location } from '@angular/common'
 import { immutableAssign } from '@app/shared/misc/utils'
 import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
 import { NotificationsService } from 'angular2-notifications'
@@ -35,6 +36,7 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
                protected authService: AuthService,
                protected notificationsService: NotificationsService,
                protected confirmService: ConfirmService,
+               protected location: Location,
                private videoService: VideoService) {
     super()
   }
index 7f2cf2d7eec20fb2ee33a001b7796eddc1753e12..728c864e9fb719519b36ba3d8de9bd50d0411660 100644 (file)
@@ -1,5 +1,6 @@
 import { ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
+import { Location } from '@angular/common'
 import { isInMobileView } from '@app/shared/misc/utils'
 import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive'
 import { NotificationsService } from 'angular2-notifications'
@@ -40,6 +41,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
   protected abstract authService: AuthService
   protected abstract router: Router
   protected abstract route: ActivatedRoute
+  protected abstract location: Location
   protected abstract currentRoute: string
   abstract titlePage: string
 
@@ -164,8 +166,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
   }
 
   protected setNewRouteParams () {
-    const routeParams = this.buildRouteParams()
-    this.router.navigate([ this.currentRoute ], { queryParams: routeParams })
+    const paramsObject = this.buildRouteParams()
+
+    const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&')
+    this.location.replaceState(this.currentRoute, queryParams)
   }
 
   protected buildVideoPages () {
index de6552875627493c1f0be9b6c95d4d647e4f6cfb..fd67be67b5cba2cee1d3a4fcc51d88e2b18c0d0e 100644 (file)
@@ -1,6 +1,7 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { immutableAssign } from '@app/shared/misc/utils'
+import { Location } from '@angular/common'
 import { NotificationsService } from 'angular2-notifications'
 import { AuthService } from '../../core/auth'
 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
@@ -23,6 +24,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
                protected route: ActivatedRoute,
                protected notificationsService: NotificationsService,
                protected authService: AuthService,
+               protected location: Location,
                private videoService: VideoService) {
     super()
   }
index cca35d0f58635d39f454a6930c0840b5bcf98344..535b6e618433a8a8d58823a30e4722cfaca99e76 100644 (file)
@@ -1,5 +1,6 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
+import { Location } from '@angular/common'
 import { immutableAssign } from '@app/shared/misc/utils'
 import { NotificationsService } from 'angular2-notifications'
 import { AuthService } from '../../core/auth'
@@ -19,6 +20,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
 
   constructor (protected router: Router,
                protected route: ActivatedRoute,
+               protected location: Location,
                protected notificationsService: NotificationsService,
                protected authService: AuthService,
                private videoService: VideoService) {
index 46a9dd48efe90e83d1cb11fcf9c63281556d407a..774d81ed6d7fc29b29b86e1e19e17f3b193bd7e4 100644 (file)
@@ -1,5 +1,6 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
+import { Location } from '@angular/common'
 import { RedirectService } from '@app/core'
 import { immutableAssign } from '@app/shared/misc/utils'
 import { NotificationsService } from 'angular2-notifications'
@@ -27,6 +28,7 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O
                protected route: ActivatedRoute,
                protected notificationsService: NotificationsService,
                protected authService: AuthService,
+               protected location: Location,
                private videoService: VideoService,
                private redirectService: RedirectService
   ) {
index 0c9e28216f6431db816efaeffcfae67d87704286..ea65070f9c3c416f64af7664d568fa340f0feb8a 100644 (file)
@@ -1,5 +1,6 @@
 import { Component, OnDestroy, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
+import { Location } from '@angular/common'
 import { immutableAssign } from '@app/shared/misc/utils'
 import { NotificationsService } from 'angular2-notifications'
 import { AuthService } from '../../core/auth'
@@ -21,6 +22,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
                protected route: ActivatedRoute,
                protected notificationsService: NotificationsService,
                protected authService: AuthService,
+               protected location: Location,
                private videoService: VideoService) {
     super()
   }