aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-15 19:05:52 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-15 19:05:52 +0200
commit7eef95353f9202e1f3285606282fc8fd904c90ef (patch)
tree550a4972d55fa9d5d2673765fd1e0174198dc350 /client/src/app
parent28f7d2020fe3ffbe5ba8a0083386f616b0186a91 (diff)
downloadPeerTube-7eef95353f9202e1f3285606282fc8fd904c90ef.tar.gz
PeerTube-7eef95353f9202e1f3285606282fc8fd904c90ef.tar.zst
PeerTube-7eef95353f9202e1f3285606282fc8fd904c90ef.zip
Client: reset pagination when we search something
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/videos/video-list/video-list.component.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts
index 062340ec5..7c6d4b992 100644
--- a/client/src/app/videos/video-list/video-list.component.ts
+++ b/client/src/app/videos/video-list/video-list.component.ts
@@ -66,6 +66,8 @@ export class VideoListComponent implements OnInit, OnDestroy {
66 // Subscribe to search changes 66 // Subscribe to search changes
67 this.subSearch = this.searchService.searchUpdated.subscribe(search => { 67 this.subSearch = this.searchService.searchUpdated.subscribe(search => {
68 this.search = search; 68 this.search = search;
69 // Reset pagination
70 this.pagination.currentPage = 1;
69 71
70 this.navigateToNewParams(); 72 this.navigateToNewParams();
71 }); 73 });
@@ -76,7 +78,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
76 this.subSearch.unsubscribe(); 78 this.subSearch.unsubscribe();
77 } 79 }
78 80
79 getVideos(detectChanges = true) { 81 getVideos() {
80 this.loading.next(true); 82 this.loading.next(true);
81 this.videos = []; 83 this.videos = [];
82 84
@@ -153,7 +155,11 @@ export class VideoListComponent implements OnInit, OnDestroy {
153 155
154 this.sort = <SortField>routeParams['sort'] || '-createdDate'; 156 this.sort = <SortField>routeParams['sort'] || '-createdDate';
155 157
156 this.pagination.currentPage = parseInt(routeParams['page']) || 1; 158 if (routeParams['page'] !== undefined) {
159 this.pagination.currentPage = parseInt(routeParams['page']);
160 } else {
161 this.pagination.currentPage = 1;
162 }
157 163
158 this.changeDetector.detectChanges(); 164 this.changeDetector.detectChanges();
159 } 165 }